|
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 org.eclipse.emf.common.notify.Adapter; |
|
20 import org.eclipse.emf.common.notify.Notification; |
|
21 import org.eclipse.emf.common.util.EList; |
|
22 import org.eclipse.emf.common.util.TreeIterator; |
|
23 import org.eclipse.emf.ecore.EClass; |
|
24 import org.eclipse.emf.ecore.EObject; |
|
25 import org.eclipse.emf.ecore.EReference; |
|
26 import org.eclipse.emf.ecore.EStructuralFeature; |
|
27 import org.eclipse.emf.ecore.resource.Resource; |
|
28 |
|
29 import cenrep.IReadOnly; |
|
30 import cenrep.RVG; |
|
31 import constraints.ReadOnlyRFS; |
|
32 |
|
33 public class ReadOnlyRFSTest extends AbstractConstraintTest { |
|
34 |
|
35 @Override |
|
36 protected Pair[] getAcceptedObjects() { |
|
37 Pair[] pair = new Pair[]{ |
|
38 new Pair(new Mock(false,true),"Accept ro=false, rfs=true"), |
|
39 new Pair(new Mock(false,false),"Accept ro=false, rfs=false"), |
|
40 new Pair(new Mock(true,false),"Accept ro=true, rfs=false"), |
|
41 }; |
|
42 return pair; |
|
43 } |
|
44 |
|
45 @Override |
|
46 protected Pair[] getRejectedObjects() { |
|
47 Pair[] pair = new Pair[]{ |
|
48 new Pair(new Mock(true,true),"Reject ro=true, rfs=true"), |
|
49 }; |
|
50 return pair; |
|
51 } |
|
52 |
|
53 @Override |
|
54 protected void setUp() throws Exception { |
|
55 constraint = new ReadOnlyRFS(); |
|
56 |
|
57 } |
|
58 |
|
59 class Mock implements IReadOnly,RVG { |
|
60 boolean ro=false; |
|
61 boolean rfs = false; |
|
62 |
|
63 public Mock(boolean ro, boolean rfs){ |
|
64 this.ro = ro; |
|
65 this.rfs = rfs; |
|
66 } |
|
67 |
|
68 @Override |
|
69 public boolean isRfs() { |
|
70 return rfs; |
|
71 } |
|
72 |
|
73 @Override |
|
74 public void setRfs(boolean value) { |
|
75 |
|
76 } |
|
77 |
|
78 @Override |
|
79 public boolean isReadOnly() { |
|
80 return ro; |
|
81 } |
|
82 |
|
83 @Override |
|
84 public void setReadOnly(boolean value) { |
|
85 |
|
86 } |
|
87 |
|
88 @Override |
|
89 public TreeIterator<EObject> eAllContents() { |
|
90 return null; |
|
91 } |
|
92 |
|
93 @Override |
|
94 public EClass eClass() { |
|
95 return null; |
|
96 } |
|
97 |
|
98 @Override |
|
99 public EObject eContainer() { |
|
100 return null; |
|
101 } |
|
102 |
|
103 @Override |
|
104 public EStructuralFeature eContainingFeature() { |
|
105 return null; |
|
106 } |
|
107 |
|
108 @Override |
|
109 public EReference eContainmentFeature() { |
|
110 return null; |
|
111 } |
|
112 |
|
113 @Override |
|
114 public EList<EObject> eContents() { |
|
115 return null; |
|
116 } |
|
117 |
|
118 @Override |
|
119 public EList<EObject> eCrossReferences() { |
|
120 return null; |
|
121 } |
|
122 |
|
123 @Override |
|
124 public Object eGet(EStructuralFeature feature, boolean resolve) { |
|
125 return null; |
|
126 } |
|
127 |
|
128 @Override |
|
129 public Object eGet(EStructuralFeature feature) { |
|
130 return null; |
|
131 } |
|
132 |
|
133 @Override |
|
134 public boolean eIsProxy() { |
|
135 return false; |
|
136 } |
|
137 |
|
138 @Override |
|
139 public boolean eIsSet(EStructuralFeature feature) { |
|
140 return false; |
|
141 } |
|
142 |
|
143 @Override |
|
144 public Resource eResource() { |
|
145 return null; |
|
146 } |
|
147 |
|
148 @Override |
|
149 public void eSet(EStructuralFeature feature, Object newValue) { |
|
150 |
|
151 } |
|
152 |
|
153 @Override |
|
154 public void eUnset(EStructuralFeature feature) { |
|
155 |
|
156 } |
|
157 |
|
158 @Override |
|
159 public EList<Adapter> eAdapters() { |
|
160 return null; |
|
161 } |
|
162 |
|
163 @Override |
|
164 public boolean eDeliver() { |
|
165 return false; |
|
166 } |
|
167 |
|
168 @Override |
|
169 public void eNotify(Notification notification) { |
|
170 |
|
171 } |
|
172 |
|
173 @Override |
|
174 public void eSetDeliver(boolean deliver) { |
|
175 |
|
176 } |
|
177 |
|
178 @Override |
|
179 public boolean canGenerate() { |
|
180 return false; |
|
181 } |
|
182 |
|
183 @Override |
|
184 public String getFolder() { |
|
185 return null; |
|
186 } |
|
187 |
|
188 @Override |
|
189 public int getGPriority() { |
|
190 return 0; |
|
191 } |
|
192 |
|
193 @Override |
|
194 public Object getGvalue() { |
|
195 return null; |
|
196 } |
|
197 |
|
198 @Override |
|
199 public String getRef() { |
|
200 return null; |
|
201 } |
|
202 |
|
203 @Override |
|
204 public void setGConf(String confName) { |
|
205 |
|
206 } |
|
207 |
|
208 @Override |
|
209 public void setGvalue(Object value) { |
|
210 |
|
211 } |
|
212 |
|
213 @Override |
|
214 public void setPriority(String prio) { |
|
215 |
|
216 } |
|
217 |
|
218 @Override |
|
219 public void setRef(String value) { |
|
220 |
|
221 } |
|
222 |
|
223 } |
|
224 } |