summaryrefslogtreecommitdiffstats
path: root/sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/framework/TestHelper.java
blob: 7bbe7ee11de409d2e9bf3db36897b94a8af56868 (plain)
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
/*
 *  Licensed to the Apache Software Foundation (ASF) under one
 *  or more contributor license agreements.  See the NOTICE file
 *  distributed with this work for additional information
 *  regarding copyright ownership.  The ASF licenses this file
 *  to you under the Apache License, Version 2.0 (the
 *  "License"); you may not use this file except in compliance
 *  with the License.  You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing,
 *  software distributed under the License is distributed on an
 *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 *  KIND, either express or implied.  See the License for the
 *  specific language governing permissions and limitations
 *  under the License.
 *  
 *  $Rev$  $Date$
 */
package test.sdo21.framework;

import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.util.Collection;

import test.sdo21.tests.ConsistencyTestTemplate;
import test.sdo21.tests.TestData.StandardDynamicFactory;
import test.sdo21.tests.TestData.StandardFactory;
import test.sdo21.tests.TestData.StandardXSDFactory;
import test.sdo21.tests.TestData.TestDataFactory;
import test.sdo21.tests.util.CTSUtil;

import commonj.sdo.DataGraph;
import commonj.sdo.DataObject;
import commonj.sdo.Type;
import commonj.sdo.helper.HelperContext;

/**
 * Vendors can provide an implementation of this interface to bootstrap their
 * SDO implementation.
 */
public interface TestHelper {

    public static final String INCOMPLETE_TEST_CASE_FAILURE = "The following test case is incomplete";

    /**
     * Initialize the SDO implementation being tests.
     */
    public void init();

    /**
     * Returns collection containing DataObject, String pairs to be used as
     * arguments to paramatized test cases. DataObjects should adhere to
     * api_test.xsd and should be populated. The String should be a description
     * of the mechanism used to create and populate the DataObject. 
     * 
     * @deprecated @see {@link ConsistencyTestTemplate}
     */
    public Collection getParamatizedDataObject();

    /**
     * Convenience method for creating a type definition.
     * 
     * @param uri
     * @param name
     * @param helperContext
     * @return
     * @deprecated
     * @see CTSUtil
     */
    public DataObject createTypeDef(String uri, String name, boolean open, HelperContext helperContext);

    /**
     * Convenience method for creating a property definition
     * 
     * @param typeDef The type definition that this property should be added to
     * @param name The name for the property
     * @param type The type to assign to the property
     * @param isMany
     * @param isContainment
     * @return
     * @deprecated
     * @see CTSUtil
     */
    public DataObject createPropertyDef(DataObject typeDef,
                                        String name,
                                        Type type,
                                        boolean isMany,
                                        boolean isContainment);

    /**
     * Convenience method for creating a property definition
     * 
     * @param typeDef The type definition that this property should be added to
     * @param name The name for the property
     * @param type The type to assign to the property e.g.
     *            "commonj.sdo#DataObject"
     * @param isMany
     * @param isContainment
     * @param helperContext
     * @return
     * 
     * @deprecated
     * @see CTSUtil

     */
    public DataObject createPropertyDef(DataObject typeDef,
                                        String name,
                                        String type,
                                        boolean isMany,
                                        boolean isContainment,
                                        HelperContext helperContext);

    /**
     * Convenience method for creating a unique name that can be used for a
     * property or type.
     *
     * @return String containing a unique name
     * 
     * @deprecated
     * @see CTSUtil

     */
    public String createUniqueName();

    /**
     * Create an empty data graph.
     * 
     * @return the new data graph instance.
     */
    public DataGraph createDataGraph();

    /**
     * Create a new HelperContext, a new scope
     * 
     * @return the new HelperContext instance.
     */
    public HelperContext createHelperContext();

    /**
     * Create a new DataObjectFactory
     * 
     * @return the new DataObjectFactory instance.
     * @deprecated
     * @see TestDataFactory
     * @see StandardFactory
     * @see StandardDynamicFactory
     * @see StandardXSDFactory
     * 
     */
    public DataObjectFactory createDataObjectFactory(String factory,
    		                                      HelperContext helperContext);
       
    /**
     * @return Static SDO that adhere's to simple.xsd
    
    public DataObject getSimpleSDO();
    */
    /**
     * @return Static Quote SDO from simple.xsd defintion.
     
    public DataObject getSimpleQuoteSDO();
    */
    
    /**
     * Create a new ObjectOutputStream
     * 
     * @return the new ObjectOutputStream instance.
     */
    public ObjectOutputStream createObjectOutputStream(OutputStream os, 
                                                    HelperContext helperContext);

    /**
     * Create a new ObjectInutStream
     * 
     * @return the new ObjectInputStream instance.
     */
    public ObjectInputStream createObjectInputStream(InputStream is, 
                                                  HelperContext helperContext);
    
    /**
     * Serialize a DataObject using an XMLStreamHelper
     */
//    public void serializeViaXMLStreamHelper(TypeHelper typeHelper, 
//                             DataObject dataObject, 
//                             XMLStreamWriter serializer);
}