|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 package testCase; |
|
18 |
|
19 import java.util.List; |
|
20 |
|
21 import org.eclipse.emf.common.notify.Adapter; |
|
22 import org.eclipse.emf.common.notify.Notification; |
|
23 import org.eclipse.emf.common.util.EList; |
|
24 import org.eclipse.emf.common.util.TreeIterator; |
|
25 import org.eclipse.emf.ecore.EClass; |
|
26 import org.eclipse.emf.ecore.EObject; |
|
27 import org.eclipse.emf.ecore.EReference; |
|
28 import org.eclipse.emf.ecore.EStructuralFeature; |
|
29 import org.eclipse.emf.ecore.resource.Resource; |
|
30 |
|
31 import cenrep.Access; |
|
32 import cenrep.Key; |
|
33 import cenrep.KeyRange; |
|
34 import cenrep.Meta; |
|
35 import cenrep.Repository; |
|
36 import constraints.RepositoryBUpOwnerConstraint; |
|
37 |
|
38 public class BackUpOwnerTest extends AbstractConstraintTest { |
|
39 |
|
40 @Override |
|
41 protected Pair[] getAcceptedObjects() { |
|
42 Pair[] pair = new Pair[]{ |
|
43 new Pair(new RepositoryMock("qwe",true),"Accepted when owner defined, bUp = true"), |
|
44 new Pair(new RepositoryMock("qwe",false),"Accepted when owner defined, bUp = false"), |
|
45 new Pair(new RepositoryMock(null,false),"Accepted when owner not defined, bUp = false"), |
|
46 new Pair(new RepositoryMock("",false),"Accepted when owner.isEmpty, bUp = false"), |
|
47 }; |
|
48 return pair; |
|
49 } |
|
50 |
|
51 @Override |
|
52 protected Pair[] getRejectedObjects() { |
|
53 Pair[] pair = new Pair[]{ |
|
54 new Pair(new RepositoryMock("",true),"Accepted when owner is empty, bUp = true"), |
|
55 new Pair(new RepositoryMock(null,true),"Accepted when owner not defined, bUp = true"), |
|
56 }; |
|
57 return pair; |
|
58 } |
|
59 |
|
60 @Override |
|
61 protected void setUp() throws Exception { |
|
62 constraint = new RepositoryBUpOwnerConstraint(); |
|
63 |
|
64 } |
|
65 |
|
66 class RepositoryMock implements Repository { |
|
67 String owner=null; |
|
68 boolean bUp = false; |
|
69 |
|
70 public RepositoryMock(String owner, boolean bUp){ |
|
71 this.owner = owner; |
|
72 this.bUp = bUp; |
|
73 } |
|
74 |
|
75 |
|
76 |
|
77 @Override |
|
78 public boolean canGenerate() { |
|
79 return false; |
|
80 } |
|
81 |
|
82 @Override |
|
83 public EList<Key> getBitmaskKeys() { |
|
84 return null; |
|
85 } |
|
86 |
|
87 @Override |
|
88 public String getFileName() { |
|
89 return null; |
|
90 } |
|
91 |
|
92 @Override |
|
93 public String getInitialisationFileVersion() { |
|
94 return null; |
|
95 } |
|
96 |
|
97 @Override |
|
98 public EList<Key> getKey() { |
|
99 return null; |
|
100 } |
|
101 |
|
102 @Override |
|
103 public List getKey(String release) { |
|
104 return null; |
|
105 } |
|
106 |
|
107 @Override |
|
108 public Meta getMeta() { |
|
109 return null; |
|
110 } |
|
111 |
|
112 @Override |
|
113 public String getOwner() { |
|
114 return owner; |
|
115 } |
|
116 |
|
117 @Override |
|
118 public String getProblems() { |
|
119 return null; |
|
120 } |
|
121 |
|
122 @Override |
|
123 public EList<KeyRange> getRangeKey() { |
|
124 return null; |
|
125 } |
|
126 |
|
127 @Override |
|
128 public EList<Key> getSimpleKeys() { |
|
129 return null; |
|
130 } |
|
131 |
|
132 @Override |
|
133 public String getUidName() { |
|
134 return null; |
|
135 } |
|
136 |
|
137 @Override |
|
138 public String getUidValue() { |
|
139 return null; |
|
140 } |
|
141 |
|
142 @Override |
|
143 public String getVersion() { |
|
144 return null; |
|
145 } |
|
146 |
|
147 @Override |
|
148 public boolean isBackup() { |
|
149 return bUp; |
|
150 } |
|
151 |
|
152 @Override |
|
153 public boolean isRfs() { |
|
154 return false; |
|
155 } |
|
156 |
|
157 @Override |
|
158 public void setBackup(boolean value) { |
|
159 |
|
160 } |
|
161 |
|
162 @Override |
|
163 public void setInitialisationFileVersion(String value) { |
|
164 |
|
165 } |
|
166 |
|
167 @Override |
|
168 public void setMeta(Meta value) { |
|
169 |
|
170 } |
|
171 |
|
172 @Override |
|
173 public void setOwner(String value) { |
|
174 |
|
175 } |
|
176 |
|
177 @Override |
|
178 public void setRfs(boolean value) { |
|
179 |
|
180 } |
|
181 |
|
182 @Override |
|
183 public void setUidName(String value) { |
|
184 |
|
185 } |
|
186 |
|
187 @Override |
|
188 public void setUidValue(String value) { |
|
189 |
|
190 } |
|
191 |
|
192 @Override |
|
193 public void setVersion(String value) { |
|
194 |
|
195 } |
|
196 |
|
197 @Override |
|
198 public List sortKeys() { |
|
199 return null; |
|
200 } |
|
201 |
|
202 @Override |
|
203 public String getId() { |
|
204 return null; |
|
205 } |
|
206 |
|
207 @Override |
|
208 public void setId(String value) { |
|
209 |
|
210 } |
|
211 |
|
212 @Override |
|
213 public EList<Access> getAccess() { |
|
214 return null; |
|
215 } |
|
216 |
|
217 @Override |
|
218 public String getGAccess() { |
|
219 return null; |
|
220 } |
|
221 |
|
222 @Override |
|
223 public Access getReadAccess() { |
|
224 return null; |
|
225 } |
|
226 |
|
227 @Override |
|
228 public Access getWriteAccess() { |
|
229 return null; |
|
230 } |
|
231 |
|
232 @Override |
|
233 public void setReadAccess(Access value) { |
|
234 |
|
235 } |
|
236 |
|
237 @Override |
|
238 public void setWriteAccess(Access value) { |
|
239 |
|
240 } |
|
241 |
|
242 @Override |
|
243 public EList<Adapter> eAdapters() { |
|
244 return null; |
|
245 } |
|
246 |
|
247 @Override |
|
248 public boolean eDeliver() { |
|
249 return false; |
|
250 } |
|
251 |
|
252 @Override |
|
253 public void eNotify(Notification notification) { |
|
254 |
|
255 } |
|
256 |
|
257 @Override |
|
258 public void eSetDeliver(boolean deliver) { |
|
259 |
|
260 } |
|
261 |
|
262 @Override |
|
263 public String getDesc() { |
|
264 return null; |
|
265 } |
|
266 |
|
267 @Override |
|
268 public void setDesc(String value) { |
|
269 |
|
270 } |
|
271 |
|
272 @Override |
|
273 public TreeIterator<EObject> eAllContents() { |
|
274 return null; |
|
275 } |
|
276 |
|
277 @Override |
|
278 public EClass eClass() { |
|
279 return null; |
|
280 } |
|
281 |
|
282 @Override |
|
283 public EObject eContainer() { |
|
284 return null; |
|
285 } |
|
286 |
|
287 @Override |
|
288 public EStructuralFeature eContainingFeature() { |
|
289 return null; |
|
290 } |
|
291 |
|
292 @Override |
|
293 public EReference eContainmentFeature() { |
|
294 return null; |
|
295 } |
|
296 |
|
297 @Override |
|
298 public EList<EObject> eContents() { |
|
299 return null; |
|
300 } |
|
301 |
|
302 @Override |
|
303 public EList<EObject> eCrossReferences() { |
|
304 return null; |
|
305 } |
|
306 |
|
307 @Override |
|
308 public Object eGet(EStructuralFeature feature, boolean resolve) { |
|
309 return null; |
|
310 } |
|
311 |
|
312 @Override |
|
313 public Object eGet(EStructuralFeature feature) { |
|
314 return null; |
|
315 } |
|
316 |
|
317 @Override |
|
318 public boolean eIsProxy() { |
|
319 return false; |
|
320 } |
|
321 |
|
322 @Override |
|
323 public boolean eIsSet(EStructuralFeature feature) { |
|
324 return false; |
|
325 } |
|
326 |
|
327 @Override |
|
328 public Resource eResource() { |
|
329 return null; |
|
330 } |
|
331 |
|
332 @Override |
|
333 public void eSet(EStructuralFeature feature, Object newValue) { |
|
334 |
|
335 } |
|
336 |
|
337 @Override |
|
338 public void eUnset(EStructuralFeature feature) { |
|
339 } |
|
340 |
|
341 } |
|
342 } |