Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 8dd6c8c0860d9caf70390a3b5379f25b81a9bcb8 (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
/**
 * Copyright (c) 2004 - 2010 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.tests.AllConfigs;
import org.eclipse.emf.cdo.tests.AuditTest;
import org.eclipse.emf.cdo.tests.AuditTestSameSession;
import org.eclipse.emf.cdo.tests.BranchingTest;
import org.eclipse.emf.cdo.tests.BranchingTestSameSession;
import org.eclipse.emf.cdo.tests.CommitInfoTest;
import org.eclipse.emf.cdo.tests.ComplexTest;
import org.eclipse.emf.cdo.tests.ContainmentTest;
import org.eclipse.emf.cdo.tests.ExternalReferenceTest;
import org.eclipse.emf.cdo.tests.LobTest;
import org.eclipse.emf.cdo.tests.LockingManagerTest;
import org.eclipse.emf.cdo.tests.MEMStoreQueryTest;
import org.eclipse.emf.cdo.tests.MergingTest;
import org.eclipse.emf.cdo.tests.MultiValuedOfAttributeTest;
import org.eclipse.emf.cdo.tests.OCLQueryTest;
import org.eclipse.emf.cdo.tests.PartialCommitTest;
import org.eclipse.emf.cdo.tests.RepositoryTest;
import org.eclipse.emf.cdo.tests.ResourceTest;
import org.eclipse.emf.cdo.tests.SetFeatureTest;
import org.eclipse.emf.cdo.tests.UnsetTest;
import org.eclipse.emf.cdo.tests.XATransactionTest;
import org.eclipse.emf.cdo.tests.XRefTest;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_252214_Test;
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_273565_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_279982_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_283985_CDOTest;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_283985_CDOTest2;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_308895_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_316444_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_319836_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_322804_Test;
import org.eclipse.emf.cdo.tests.config.impl.ConfigTest;
import org.eclipse.emf.cdo.tests.config.impl.RepositoryConfig;
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 final RepositoryConfig HIBERNATE = HibernateConfig.INSTANCE;

  public static Test suite()
  {
    return new AllTestsHibernate().getTestSuite("CDO Tests (Hibernate)");
  }

  @Override
  protected void initConfigSuites(TestSuite parent)
  {
    addScenario(parent, COMBINED, HIBERNATE, JVM, NATIVE);
  }

  @Override
  protected void initTestClasses(List<Class<? extends ConfigTest>> testClasses)
  {
    testClasses.add(XRefTest.class);
    testClasses.add(LobTest.class);
    testClasses.add(RepositoryTest.class);

    testClasses.add(Hibernate_Bugzilla_279982_Test.class);
    testClasses.add(Hibernate_ContainmentTest.class);
    testClasses.add(HibernateXATransactionTest.class);
    testClasses.add(Hibernate_Bugzilla_308895_Test.class);
    testClasses.add(HibernateExternalAnnotationTest.class);
    testClasses.add(HibernateMultiValuedOfAttributeTest.class);
    testClasses.add(HibernateXATransactionTest.class);
    testClasses.add(HibernateExternalReferenceTest.class);
    testClasses.add(HibernateQueryTest.class);
    testClasses.add(HibernateQueryNoCachingTest.class);
    testClasses.add(HibernateBugzilla_258933_Test.class);
    testClasses.add(HibernateUnsetTest.class);
    testClasses.add(HibernateBugzilla_301104_Test.class);
    testClasses.add(Hibernate_SetFeatureTest.class);
    testClasses.add(Hibernate_ResourceTest.class);
    testClasses.add(Hibernate_ComplexTest.class);
    testClasses.add(Hibernate_PartialCommitTest.class);
    testClasses.add(Hibernate_Bugzilla_316444_Test.class);

    super.initTestClasses(testClasses);

    // 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);

    testClasses.remove(Bugzilla_279982_Test.class);

    // are replaced by Hibernate specific ones, mostly
    // to prevent tests doing move from one container to another
    testClasses.remove(ContainmentTest.class);
    testClasses.remove(ComplexTest.class);
    testClasses.remove(ResourceTest.class);
    testClasses.remove(SetFeatureTest.class);
    testClasses.remove(PartialCommitTest.class);
    testClasses.remove(Bugzilla_316444_Test.class);
    testClasses.remove(Bugzilla_308895_Test.class);

    // contains a lot of containment move, which is not supported by Hibernate
    testClasses.remove(Bugzilla_283985_CDOTest.class);
    testClasses.remove(Bugzilla_283985_CDOTest2.class);
    testClasses.remove(Bugzilla_319836_Test.class);

    // OCL querying not supported
    testClasses.remove(OCLQueryTest.class);

    // Branching not supported
    testClasses.remove(BranchingTest.class);
    testClasses.remove(MergingTest.class);
    testClasses.remove(BranchingTestSameSession.class);

    // Commit info not supported
    testClasses.remove(CommitInfoTest.class);

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

    // results in infinite loops it seems
    // runs okay when run standalone
    testClasses.remove(Bugzilla_273565_Test.class);

    // audit support to do
    // bug 244141
    testClasses.remove(AuditTest.class);
    testClasses.remove(AuditTestSameSession.class);
    testClasses.remove(Bugzilla_252214_Test.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.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.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.remove(Bugzilla_258933_Test.class);

    // remove as unsettable has to be re-visited for the hb store
    // see bugzilla 298579
    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()
    {
    }
  }

  /**
   * @author Eike Stepper
   */
  public static class Hibernate_Bugzilla_308895_Test extends Bugzilla_308895_Test
  {
    @Override
    public void setUp() throws Exception
    {
      super.setUp();
      // final EAttribute att = getAtt();

      // add a teneo annotation
      // final EAnnotation eAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
      // eAnnotation.setSource("teneo.jpa");
      // eAnnotation.getDetails().put("value", value)
      //
      // att.getEAnnotations().add(eAnnotation);
    }
  }

  // unsettable is hardly supported by the Hibernate Store
  public static class Hibernate_SetFeatureTest extends SetFeatureTest
  {
    @Override
    public void testUnsettableDateNoDefault_SetDefault() throws Exception
    {
    }

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

  // disable some container move tests, containment move is not supported
  // by hibernate
  public static class Hibernate_ResourceTest extends ResourceTest
  {
    @Override
    public void testChangePathFromDepth3ToDepth0() throws Exception
    {
    }

    @Override
    public void testChangeResourceURI() throws Exception
    {
    }

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

  public static class Hibernate_ComplexTest extends ComplexTest
  {
    @Override
    public void testMigrateContainmentMulti()
    {
    }

  }

  public static class Hibernate_PartialCommitTest extends PartialCommitTest
  {
    @Override
    public void testMove() throws CommitException
    {
    }

    @Override
    public void testDoubleMove() throws CommitException
    {
    }
  }

  public static class Hibernate_Bugzilla_316444_Test extends Bugzilla_316444_Test
  {
    @Override
    public void testLockParentWithEAttributeChange() throws Exception
    {
    }

    @Override
    public void testMovingSubtree() throws Exception
    {
    }

  }

  public static class Hibernate_ContainmentTest extends ContainmentTest
  {
    // this testcase is overridden because it uses an ereference which should be
    // annotated with @External, but which can't be mapped like that because it is
    // also used non-externally by other testcases
    @Override
    public void testObjectNotSameResourceThanItsContainerCDOANDXMI() throws Exception
    {
    }

    // see:
    // https://bugs.eclipse.org/bugs/show_bug.cgi?id=330207#c1
    @Override
    public void testModeledBackPointer_Transient() throws Exception
    {
    }

    // see:
    // https://bugs.eclipse.org/bugs/show_bug.cgi?id=330207#c1
    @Override
    public void testModeledBackPointer_Transient_Load() 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)
      {
        assertTrue(e instanceof CommitException);
        assertTrue(e.getMessage().contains("org.hibernate.ObjectNotFoundException"));
      }
    }

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

Back to the top