1 10 11 package com.triactive.jdo.test.views; 12 13 import com.triactive.jdo.test.*; 14 import javax.jdo.JDOFatalUserException; 15 16 17 23 24 public class ViewCreationTest extends PersistenceTestCase 25 { 26 27 33 34 public ViewCreationTest(String name) 35 { 36 super(name); 37 } 38 39 40 protected void setUp() throws Exception 41 { 42 super.setUp(); 43 44 schemaMgr.dropTablesFor(new Class [] 45 { 46 DependentView.class, 47 ReliedOnView.class 48 } 49 ); 50 51 addClassesToSchema(new Class [] { Widget.class }); 52 } 53 54 55 58 public void testCreatingDependentFirst() 59 throws Exception 60 { 61 addClassesToSchema(new Class [] 62 { 63 DependentView.class, 64 ReliedOnView.class 65 } 66 ); 67 } 68 69 70 73 public void testCreatingReliedOnFirst() 74 throws Exception 75 { 76 addClassesToSchema(new Class [] 77 { 78 ReliedOnView.class, 79 DependentView.class 80 } 81 ); 82 } 83 84 85 88 public void testCircularViewDependencies() 89 { 90 93 try 94 { 95 addClassesToSchema(new Class [] 96 { 97 CircularReferenceView1.class 98 } 99 ); 100 fail("Creating a view with a circular dependency should have thrown exception."); 101 } 102 catch (JDOFatalUserException e) { } 103 104 try 105 { 106 addClassesToSchema(new Class [] 107 { 108 CircularReferenceView2.class 109 } 110 ); 111 fail("Creating a view with a circular dependency should have thrown exception."); 112 } 113 catch (JDOFatalUserException e) { } 114 115 try 116 { 117 addClassesToSchema(new Class [] 118 { 119 CircularReferenceView3.class 120 } 121 ); 122 fail("Creating a view with a circular dependency should have thrown exception."); 123 } 124 catch (JDOFatalUserException e) { } 125 126 127 130 try 131 { 132 addClassesToSchema(new Class [] 133 { 134 CircularReferenceView1.class, 135 CircularReferenceView2.class 136 } 137 ); 138 fail("Creating a view with a circular dependency should have thrown exception."); 139 } 140 catch (JDOFatalUserException e) { } 141 try 142 { 143 addClassesToSchema(new Class [] 144 { 145 CircularReferenceView2.class, 146 CircularReferenceView1.class 147 } 148 ); 149 fail("Creating a view with a circular dependency should have thrown exception."); 150 } 151 catch (JDOFatalUserException e) { } 152 153 try 154 { 155 addClassesToSchema(new Class [] 156 { 157 CircularReferenceView1.class, 158 CircularReferenceView3.class 159 } 160 ); 161 fail("Creating a view with a circular dependency should have thrown exception."); 162 } 163 catch (JDOFatalUserException e) { } 164 try 165 { 166 addClassesToSchema(new Class [] 167 { 168 CircularReferenceView3.class, 169 CircularReferenceView1.class 170 } 171 ); 172 fail("Creating a view with a circular dependency should have thrown exception."); 173 } 174 catch (JDOFatalUserException e) { } 175 176 try 177 { 178 addClassesToSchema(new Class [] 179 { 180 CircularReferenceView2.class, 181 CircularReferenceView3.class 182 } 183 ); 184 fail("Creating a view with a circular dependency should have thrown exception."); 185 } 186 catch (JDOFatalUserException e) { } 187 try 188 { 189 addClassesToSchema(new Class [] 190 { 191 CircularReferenceView3.class, 192 CircularReferenceView2.class 193 } 194 ); 195 fail("Creating a view with a circular dependency should have thrown exception."); 196 } 197 catch (JDOFatalUserException e) { } 198 199 200 203 try 204 { 205 addClassesToSchema(new Class [] 206 { 207 CircularReferenceView1.class, 208 CircularReferenceView2.class, 209 CircularReferenceView3.class 210 } 211 ); 212 fail("Creating a view with a circular dependency should have thrown exception."); 213 } 214 catch (JDOFatalUserException e) { } 215 216 try 217 { 218 addClassesToSchema(new Class [] 219 { 220 CircularReferenceView1.class, 221 CircularReferenceView3.class, 222 CircularReferenceView2.class 223 } 224 ); 225 fail("Creating a view with a circular dependency should have thrown exception."); 226 } 227 catch (JDOFatalUserException e) { } 228 229 try 230 { 231 addClassesToSchema(new Class [] 232 { 233 CircularReferenceView2.class, 234 CircularReferenceView1.class, 235 CircularReferenceView3.class 236 } 237 ); 238 fail("Creating a view with a circular dependency should have thrown exception."); 239 } 240 catch (JDOFatalUserException e) { } 241 242 try 243 { 244 addClassesToSchema(new Class [] 245 { 246 CircularReferenceView2.class, 247 CircularReferenceView3.class, 248 CircularReferenceView1.class 249 } 250 ); 251 fail("Creating a view with a circular dependency should have thrown exception."); 252 } 253 catch (JDOFatalUserException e) { } 254 255 try 256 { 257 addClassesToSchema(new Class [] 258 { 259 CircularReferenceView3.class, 260 CircularReferenceView1.class, 261 CircularReferenceView2.class 262 } 263 ); 264 fail("Creating a view with a circular dependency should have thrown exception."); 265 } 266 catch (JDOFatalUserException e) { } 267 268 try 269 { 270 addClassesToSchema(new Class [] 271 { 272 CircularReferenceView3.class, 273 CircularReferenceView2.class, 274 CircularReferenceView1.class 275 } 276 ); 277 fail("Creating a view with a circular dependency should have thrown exception."); 278 } 279 catch (JDOFatalUserException e) { } 280 } 281 } 282 | Popular Tags |