Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: d7468e54cb4536f2650262c875bb97cd6aace008 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
/*
 * Copyright (c) 2008-2014 Eike Stepper (Berlin, Germany) and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Eike Stepper - initial API and implementation
 */
package org.eclipse.emf.cdo.tests.hibernate;

import org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore;
import org.eclipse.emf.cdo.tests.AllConfigs;
import org.eclipse.emf.cdo.tests.AttributeTest;
import org.eclipse.emf.cdo.tests.BackupTest;
import org.eclipse.emf.cdo.tests.CommitInfoTest;
import org.eclipse.emf.cdo.tests.CrossReferenceTest;
import org.eclipse.emf.cdo.tests.DynamicXSDTest;
import org.eclipse.emf.cdo.tests.EMFCompareTest;
import org.eclipse.emf.cdo.tests.ExternalReferenceTest;
import org.eclipse.emf.cdo.tests.FeatureMapTest;
import org.eclipse.emf.cdo.tests.LockingManagerRestartRepositoryTest;
import org.eclipse.emf.cdo.tests.LockingManagerRestartSessionTest;
import org.eclipse.emf.cdo.tests.LockingManagerRestartTransactionTest;
import org.eclipse.emf.cdo.tests.LockingManagerTest;
import org.eclipse.emf.cdo.tests.LockingNotificationsTest;
import org.eclipse.emf.cdo.tests.MEMStoreQueryTest;
import org.eclipse.emf.cdo.tests.MultiValuedOfAttributeTest;
import org.eclipse.emf.cdo.tests.OCLQueryTest;
import org.eclipse.emf.cdo.tests.PackageRegistryTest;
import org.eclipse.emf.cdo.tests.SecurityTest;
import org.eclipse.emf.cdo.tests.TransactionTest;
import org.eclipse.emf.cdo.tests.UnsetTest;
import org.eclipse.emf.cdo.tests.WorkspaceTest;
import org.eclipse.emf.cdo.tests.XATransactionTest;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_258933_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_272861_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_279982_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_303466_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_306998_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_322804_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_329254_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_334995_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_347964_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_351393_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_352204_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_359966_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_362270_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_362270b_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_362270c_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_365832_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_381472_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_390185_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_400236_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_405191_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_416474_Test;
import org.eclipse.emf.cdo.tests.config.IRepositoryConfig;
import org.eclipse.emf.cdo.tests.config.IScenario;
import org.eclipse.emf.cdo.tests.config.impl.ConfigTest;
import org.eclipse.emf.cdo.util.CommitException;

import java.util.List;

import junit.framework.Test;
import junit.framework.TestSuite;

/**
 * @author Eike Stepper
 */
public class AllTestsHibernate extends AllConfigs
{
  public static Test suite()
  {
    return new AllTestsHibernate().getTestSuite();
  }

  @Override
  protected void initConfigSuites(TestSuite parent)
  {
    addScenario(parent, HibernateConfig.INSTANCE, JVM, NATIVE);
    addScenario(parent, HibernateConfig.AUDIT_INSTANCE, JVM, NATIVE);
  }

  @Override
  protected void initTestClasses(List<Class<? extends ConfigTest>> testClasses, IScenario scenario)
  {
    // testClasses.clear();
    // testClasses.add(HibernateBugzilla_417797_Test.class);
    // if (true)
    // {
    // return;
    // }

    super.initTestClasses(testClasses, scenario);

    // TODO: find out why this does not work for non-auditing
    if (scenario.getRepositoryConfig().isSupportingAudits())
    {
      testClasses.add(HibernateBugzilla_380987_Test.class);
    }

    testClasses.add(HibernateChunkingTest.class);
    testClasses.add(Hibernate_Failure_Test.class);
    testClasses.add(Hibernate_Export_Test.class);
    testClasses.add(HibernateBugzilla_381013_Test.class);
    testClasses.add(HibernateBugzilla_417797_Test.class);

    testClasses.add(HibernateBugzilla_392653_Test.class);
    testClasses.add(HibernateBugzilla_387752_Test.class);
    testClasses.add(HibernateBugzilla_387752_True_Test.class);

    testClasses.add(HibernateBugzilla_333473_Test.class);

    testClasses.add(HibernateTimeStampTest.class);
    // removed stalls
    // testClasses.add(HibernateXATransactionTest.class);
    testClasses.add(HibernateExternalAnnotationTest.class);
    testClasses.add(HibernateQueryTest.class);
    testClasses.add(HibernateQueryNoCachingTest.class);
    testClasses.add(HibernateBugzilla_301104_Test.class);

    // this bugzilla persists an ecore package, not
    // supported without extra annotations.
    testClasses.remove(Bugzilla_416474_Test.class);

    testClasses.remove(TransactionTest.class);
    testClasses.add(HibernateTransactionTest.class);

    // remove as it tries to persist an eannotation
    testClasses.remove(Bugzilla_400236_Test.class);

    testClasses.add(HibernateBugzilla_362270b_Test.class);
    testClasses.remove(Bugzilla_362270b_Test.class);

    testClasses.add(HibernateBugzilla_362270c_Test.class);
    testClasses.remove(Bugzilla_362270c_Test.class);

    testClasses.add(HibernateBugzilla_405191_Test.class);
    testClasses.remove(Bugzilla_405191_Test.class);

    // for some reason this test needs to be done first...
    testClasses.remove(Bugzilla_306998_Test.class);
    testClasses.add(0, Bugzilla_306998_Test.class);

    testClasses.remove(CrossReferenceTest.class);
    testClasses.add(HibernateCrossReferenceTest.class);

    testClasses.add(HibernateBugzilla_356181_Test.class);

    // the hb store throws an error on deadlocked transaction
    // and does not block
    testClasses.remove(Bugzilla_390185_Test.class);

    testClasses.add(HibernateBugzilla_398057_Test.class);
    testClasses.add(HibernateBugzilla_397682_Test.class);

    testClasses.add(HibernateBugzilla_416530_Test.class);

    // not supported specific OCL operations
    // TODO: research this
    testClasses.remove(Bugzilla_416474_Test.class);

    if (scenario.getRepositoryConfig().isSupportingAudits())
    {
      // need to add additional auditing annotations
      testClasses.remove(HibernateBugzilla_405191_Test.class);

      // stalls in case of auditing
      // TODO: research this
      testClasses.remove(OCLQueryTest.class);
      testClasses.remove(OCLQueryTest.Lazy.class);

      testClasses.add(HibernateBugzilla_395684_Test.class);

      testClasses.add(CDOObjectHistoryTest.class);

      // the security model inherits from the ecore model
      // not so well supported for now for auditing
      testClasses.remove(SecurityTest.class);

      // the package registry count changes when auditing
      // as auditing adds epackages
      testClasses.remove(PackageRegistryTest.class);
      testClasses.add(HibernatePackageRegistryTest.class);
      testClasses.remove(Bugzilla_303466_Test.class);
      testClasses.add(Hibernate_Bugzilla_303466_Test.class);

      // feature maps are not handled correctly in CDO with auditing
      testClasses.remove(FeatureMapTest.class);
    }
    else
    {
      // these testcases uses commitinfo
      // only supported with auditing
      testClasses.remove(Bugzilla_329254_Test.class);
      testClasses.remove(Hibernate_Bugzilla_329254_Test.class);

      // Commit info only works with auditing
      testClasses.remove(CommitInfoTest.class);
    }

    // renaming a resource is not possible in the hibernate store.
    testClasses.remove(Bugzilla_334995_Test.class);

    // repository restart is not supported in the hibernate store
    // as it clears the database
    testClasses.remove(Bugzilla_347964_Test.class);

    // workspaces are not supported
    testClasses.remove(WorkspaceTest.class);

    testClasses.remove(DynamicXSDTest.class);

    // delete repo is not yet supported
    testClasses.remove(Bugzilla_381472_Test.class);

    testClasses.remove(Bugzilla_362270_Test.class);

    // persisting models in a resource is not supported
    testClasses.remove(Bugzilla_365832_Test.class);
    testClasses.remove(Bugzilla_352204_Test.class);
    testClasses.remove(Bugzilla_359966_Test.class);

    // external reference in a resource not supported
    testClasses.remove(Bugzilla_351393_Test.class);

    // hibernate does not support persisting
    // java class and object
    testClasses.add(HibernateAttributeTest.class);
    testClasses.remove(AttributeTest.class);

    // Use a hibernate specific test class
    // https://bugs.eclipse.org/bugs/show_bug.cgi?id=339492
    testClasses.add(Hibernate_BackupTest.class);
    testClasses.remove(BackupTest.class);

    // Teneo does not yet support lists of int arrays:
    // https://bugs.eclipse.org/bugs/show_bug.cgi?id=330212
    testClasses.remove(Bugzilla_322804_Test.class);

    // overridden because Hibernate will treat all stale references as an exception
    testClasses.add(Hibernate_Bugzilla_279982_Test.class);
    testClasses.remove(Bugzilla_279982_Test.class);

    // locking not supported
    testClasses.remove(LockingManagerRestartRepositoryTest.class);
    testClasses.remove(LockingManagerRestartSessionTest.class);
    testClasses.remove(LockingManagerRestartTransactionTest.class);
    testClasses.remove(LockingNotificationsTest.class);
    testClasses.remove(LockingManagerRestartRepositoryTest.class);

    // Locking manager not supported
    testClasses.remove(LockingManagerTest.class);

    // problem with wrong version of EMF Compare
    testClasses.remove(EMFCompareTest.class);

    // replace a test with our local implementation:
    // the MultiValueOfAttributeTest class has a method
    // testListOfInteger which has a List with a null value
    // this is not nicely supported by Hibernate
    // therefore this step is removed
    testClasses.add(HibernateMultiValuedOfAttributeTest.class);
    testClasses.remove(MultiValuedOfAttributeTest.class);

    // MemStore is not relevant
    testClasses.remove(MEMStoreQueryTest.class);

    // replace test case to do external mapping
    testClasses.remove(XATransactionTest.class);

    // replace test case with one, disabling some non working testcases
    // see the HibernateExternalReferenceTest for a description
    testClasses.add(HibernateExternalReferenceTest.class);
    testClasses.remove(ExternalReferenceTest.class);

    // this testcases removes and creates a resource with the
    // same path in one transaction, that's not supported
    // by hibernate.. because of unique key constraints
    testClasses.remove(Bugzilla_272861_Test.class);

    // override a testcase because the hibernate store
    // has a different meaning of unset
    testClasses.add(HibernateBugzilla_258933_Test.class);
    testClasses.remove(Bugzilla_258933_Test.class);

    // replace as unsettable has to be re-visited for the hb store
    // see Bug 298579, it does not work for object types
    testClasses.add(HibernateUnsetTest.class);
    testClasses.remove(UnsetTest.class);
  }

  /**
   * Overridden because one testcase does not pass as Hibernate currently does not store the isset boolean values in the
   * database.
   *
   * @author Eike Stepper
   */
  public static class HibernateUnsetTest extends UnsetTest
  {
    @Override
    public void testUnsettableBaseTypeVsObjectType()
    {
    }
  }

  public static class HibernatePackageRegistryTest extends PackageRegistryTest
  {

    @Override
    public void testCommitNestedPackages() throws Exception
    {
    }

    @Override
    public void testCommitTopLevelPackages() throws Exception
    {
    }
  }

  // overridden because Hibernate will treat all stale references as an exception
  public static class Hibernate_Bugzilla_279982_Test extends Bugzilla_279982_Test
  {
    @Override
    public void testBugzilla_279982_Single() throws Exception
    {
      try
      {
        super.testBugzilla_279982_Single();
      }
      catch (Exception e)
      {
        assertEquals(true, e instanceof CommitException);
        assertEquals(true, e.getMessage().contains("org.hibernate.ObjectNotFoundException"));
      }
    }

    @Override
    public void testBugzilla_279982_Multi_RevisionPrefetchingPolicy() throws Exception
    {
      try
      {
        super.testBugzilla_279982_Multi_RevisionPrefetchingPolicy();
      }
      catch (Exception e)
      {
        assertEquals(true, e instanceof CommitException);
        assertEquals(true, e.getMessage().contains("org.hibernate.ObjectNotFoundException"));
      }
    }
  }

  public static class Hibernate_BackupTest extends BackupTest
  {

    @Override
    protected void doSetUp() throws Exception
    {
      final IRepositoryConfig repConfig = getRepositoryConfig();
      final HibernateConfig hbConfig = (HibernateConfig)repConfig;
      final String persistenceXML = "org/eclipse/emf/cdo/tests/hibernate/cdo_hibernate.persistence.xml";
      hbConfig.getAdditionalProperties().put(HibernateStore.PERSISTENCE_XML, persistenceXML);

      super.doSetUp();
    }

    @Override
    protected void doTearDown() throws Exception
    {
      final IRepositoryConfig repConfig = getRepositoryConfig();
      final HibernateConfig hbConfig = (HibernateConfig)repConfig;
      hbConfig.getAdditionalProperties().clear();
      super.doTearDown();
    }
  }

  public static class Hibernate_Bugzilla_303466_Test extends Bugzilla_303466_Test
  {

    @Override
    public void test_missingDependency() throws Exception
    {
    }

  }

  public static class Hibernate_Bugzilla_329254_Test extends Bugzilla_329254_Test
  {

    // does not work for non audited cases
    @Override
    public void testCommitTimeStampUpdateOnError() throws Exception
    {
    }

  }

  public static class HibernateTransactionTest extends TransactionTest
  {

    // fails with timeout exceptions, ignore testcase for now
    @Override
    public void testCreateManySessionsAndTransactionsMultiThread() throws Exception
    {
    }
  }
}

Back to the top