Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: db668bb9b93f353c289521efb7a08a8757fe9376 (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
/*
 * Copyright (c) 2015, 2016 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.db;

import org.eclipse.emf.cdo.common.CDOCommonRepository.IDGenerationLocation;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_416474_Test;
import org.eclipse.emf.cdo.tests.config.IConstants;
import org.eclipse.emf.cdo.tests.config.impl.ConfigTest;
import org.eclipse.emf.cdo.tests.config.impl.ModelConfig;
import org.eclipse.emf.cdo.tests.config.impl.RepositoryConfig;
import org.eclipse.emf.cdo.tests.config.impl.Scenario;
import org.eclipse.emf.cdo.tests.config.impl.SessionConfig;

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

/**
 * @author Eike Stepper
 */
public class AnyTestManyTimesDB extends TestSuite implements IConstants
{
  private static final boolean SUPPORTING_AUDITS = false;

  private static final boolean SUPPORTING_BRANCHES = false;

  private static final boolean WITH_RANGES = false;

  private static final boolean COPY_ON_BRANCH = false;

  private static final boolean INVERSE_LISTS = false;

  private static final IDGenerationLocation ID_GENERATION_LOCATION = IDGenerationLocation.STORE;

  private static final RepositoryConfig REPOSITORY_CONFIG = new H2Config().supportingAudits(SUPPORTING_AUDITS).supportingBranches(SUPPORTING_BRANCHES)
      .withRanges(WITH_RANGES).copyOnBranch(COPY_ON_BRANCH).inverseLists(INVERSE_LISTS).idGenerationLocation(ID_GENERATION_LOCATION);

  private static final SessionConfig SESSION_CONFIG = JVM;

  private static final ModelConfig MODEL_CONFIG = NATIVE;

  private static final String METHOD = "testMatchesAnyStringAttribute";

  private static final int RUNS = 10000;

  private static ConfigTest createTest(final String displayName)
  {
    return new Bugzilla_416474_Test()
    {
      @Override
      public String getName()
      {
        return displayName;
      }

      @Override
      protected String getTestMethodName()
      {
        return METHOD;
      }
    };
  }

  public static Test suite()
  {
    TestSuite suite = new TestSuite(AnyTestManyTimesDB.class)
    {
      @Override
      public void addTest(Test test)
      {
        if (test instanceof TestCase)
        {
          TestCase testCase = (TestCase)test;
          if ("warning".equals(testCase.getName()))
          {
            return;
          }
        }

        super.addTest(test);
      }
    };

    for (int run = 0; run < RUNS; run++)
    {
      ConfigTest test = createTest(METHOD + " [" + (run + 1) + "]");
      test.setName(METHOD);
      test.setScenario(new Scenario(REPOSITORY_CONFIG, SESSION_CONFIG, MODEL_CONFIG)
      {
        private static final long serialVersionUID = 1L;

        @Override
        public boolean alwaysCleanRepositories()
        {
          return true;
        }
      });

      suite.addTest(test);
    }

    return suite;
  }
}

Back to the top