Skip to main content
summaryrefslogtreecommitdiffstats
blob: 95fcc23500c58397d0e3946c24a3520a1126d951 (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
/**
 * 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.store.logic;

import org.eclipse.emf.cdo.internal.server.Transaction;
import org.eclipse.emf.cdo.server.db.IMappingStrategy;
import org.eclipse.emf.cdo.server.internal.db.HorizontalMappingStrategy;
import org.eclipse.emf.cdo.server.internal.db.MappingStrategy;
import org.eclipse.emf.cdo.server.internal.db.ToMany;
import org.eclipse.emf.cdo.server.internal.db.ToOne;

import java.util.HashMap;
import java.util.Map;

/**
 * @author Eike Stepper
 */
public abstract class HorizontalTestLogic extends DBStoreTestLogic
{
  public HorizontalTestLogic()
  {
  }

  @Override
  protected IMappingStrategy createMappingStrategy()
  {
    Map<String, String> props = new HashMap<String, String>();
    props.put(MappingStrategy.PROP_TO_MANY_REFERENCE_MAPPING, ToMany.PER_CLASS.toString());
    props.put(MappingStrategy.PROP_TO_ONE_REFERENCE_MAPPING, ToOne.LIKE_ATTRIBUTES.toString());

    HorizontalMappingStrategy mappingStrategy = new HorizontalMappingStrategy();
    mappingStrategy.setProperties(props);
    return mappingStrategy;
  }

  @Override
  protected void verifyCreateModel1(Transaction transaction) throws Exception
  {
    defineOrCompare("defs/horizontal/verifyCreateModel1");
    // assertRowCount(1, "cdo_repository");
    // assertRowCount(1, "cdo_packages");
    // assertRowCount(11, "cdo_classes");
    // assertRowCount(8, "cdo_supertypes");
    // assertRowCount(26, "cdo_features");
  }

  @Override
  protected void verifyCreateModel2(Transaction transaction) throws Exception
  {
    defineOrCompare("defs/horizontal/verifyCreateModel2");
    // assertRowCount(1, "cdo_repository");
    // assertRowCount(2, "cdo_packages");
    // assertRowCount(12, "cdo_classes");
    // assertRowCount(9, "cdo_supertypes");
    // assertRowCount(28, "cdo_features");
  }

  @Override
  protected void verifyCreateModel3(Transaction transaction) throws Exception
  {
    defineOrCompare("defs/horizontal/verifyCreateModel3");
    // assertRowCount(1, "cdo_repository");
    // assertRowCount(1, "cdo_packages");
    // assertRowCount(1, "cdo_classes");
    // assertRowCount(0, "cdo_supertypes");
    // assertRowCount(1, "cdo_features");
  }

  @Override
  protected void verifyCreateMango(Transaction transaction) throws Exception
  {
    defineOrCompare("defs/horizontal/verifyCreateMango");
    // assertRowCount(1, "cdo_repository");
    // assertRowCount(1, "cdo_packages");
    // assertRowCount(2, "cdo_classes");
    // assertRowCount(0, "cdo_supertypes");
    // assertRowCount(3, "cdo_features");
  }

  @Override
  protected void verifyCommitCompany(Transaction transaction) throws Exception
  {
    defineOrCompare("defs/horizontal/verifyCommitCompany");
    // assertRowCount(1, "CDOResource");
    // assertFieldValue("/res1", "select path_0 from CDOResource where cdo_id=1 and cdo_version=1");
    //
    // assertRowCount(1, "Company");
    // assertFieldValue("Sympedia", "select name from Company where cdo_id=1 and cdo_version=1");
    // assertFieldValue("Homestr. 17", "select street from Company where cdo_id=1 and cdo_version=1");
    // assertFieldValue("Berlin", "select city from Company where cdo_id=1 and cdo_version=1");
  }
}

Back to the top