|
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.ACCESS_TYPE; |
|
30 import cenrep.Access; |
|
31 import cenrep.CenrepPackage; |
|
32 import constraints.CapaAmount; |
|
33 |
|
34 public class CapaAmountTest extends AbstractConstraintTest { |
|
35 |
|
36 @Override |
|
37 protected Pair[] getAcceptedObjects() { |
|
38 Pair[] pair = new Pair[]{ |
|
39 new Pair(new AccessMock("z,x,c,v,b,n,m"),"Accept 7 unknown caps."), |
|
40 new Pair(new AccessMock("z,x,c","222"),"Accept 3 with SID unknown caps."), |
|
41 }; |
|
42 return pair; |
|
43 } |
|
44 |
|
45 @Override |
|
46 protected Pair[] getRejectedObjects() { |
|
47 Pair[] pair = new Pair[]{ |
|
48 new Pair(new AccessMock("a,s,d,f,g,h,j,k"),"reject 8 unknown caps."), |
|
49 new Pair(new AccessMock("z,x,c,2","222"),"Accept 3 with SID unknown caps."), |
|
50 }; |
|
51 return pair; |
|
52 } |
|
53 |
|
54 @Override |
|
55 protected void setUp() throws Exception { |
|
56 constraint = new CapaAmount(); |
|
57 } |
|
58 |
|
59 class AccessMock implements Access{ |
|
60 String cap=null; |
|
61 String sid=null; |
|
62 |
|
63 public AccessMock(String cap){ |
|
64 this.cap=cap; |
|
65 } |
|
66 |
|
67 public AccessMock(String cap,String sid){ |
|
68 this.cap=cap; |
|
69 this.sid = sid; |
|
70 } |
|
71 |
|
72 @Override |
|
73 public String getCapabilities() { |
|
74 return cap; |
|
75 } |
|
76 |
|
77 @Override |
|
78 public String getSid() { |
|
79 return sid; |
|
80 } |
|
81 |
|
82 @Override |
|
83 public String getStrFormat() { |
|
84 return null; |
|
85 } |
|
86 |
|
87 @Override |
|
88 public ACCESS_TYPE getType() { |
|
89 return null; |
|
90 } |
|
91 |
|
92 @Override |
|
93 public void setCapabilities(String value) { |
|
94 |
|
95 } |
|
96 |
|
97 @Override |
|
98 public void setSid(String value) { |
|
99 |
|
100 } |
|
101 |
|
102 @Override |
|
103 public void setType(ACCESS_TYPE value) { |
|
104 |
|
105 } |
|
106 |
|
107 @Override |
|
108 public String getDesc() { |
|
109 return null; |
|
110 } |
|
111 |
|
112 @Override |
|
113 public void setDesc(String value) { |
|
114 |
|
115 } |
|
116 |
|
117 @Override |
|
118 public String getId() { |
|
119 return null; |
|
120 } |
|
121 |
|
122 @Override |
|
123 public void setId(String value) { |
|
124 |
|
125 } |
|
126 |
|
127 @Override |
|
128 public TreeIterator<EObject> eAllContents() { |
|
129 return null; |
|
130 } |
|
131 |
|
132 @Override |
|
133 public EClass eClass() { |
|
134 return CenrepPackage.eINSTANCE.getAccess(); |
|
135 } |
|
136 |
|
137 @Override |
|
138 public EObject eContainer() { |
|
139 return this; |
|
140 } |
|
141 |
|
142 @Override |
|
143 public EStructuralFeature eContainingFeature() { |
|
144 return null; |
|
145 } |
|
146 |
|
147 @Override |
|
148 public EReference eContainmentFeature() { |
|
149 return null; |
|
150 } |
|
151 |
|
152 @Override |
|
153 public EList<EObject> eContents() { |
|
154 return null; |
|
155 } |
|
156 |
|
157 @Override |
|
158 public EList<EObject> eCrossReferences() { |
|
159 return null; |
|
160 } |
|
161 |
|
162 @Override |
|
163 public Object eGet(EStructuralFeature feature, boolean resolve) { |
|
164 return null; |
|
165 } |
|
166 |
|
167 @Override |
|
168 public Object eGet(EStructuralFeature feature) { |
|
169 return null; |
|
170 } |
|
171 |
|
172 @Override |
|
173 public boolean eIsProxy() { |
|
174 return false; |
|
175 } |
|
176 |
|
177 @Override |
|
178 public boolean eIsSet(EStructuralFeature feature) { |
|
179 return false; |
|
180 } |
|
181 |
|
182 @Override |
|
183 public Resource eResource() { |
|
184 return null; |
|
185 } |
|
186 |
|
187 @Override |
|
188 public void eSet(EStructuralFeature feature, Object newValue) { |
|
189 |
|
190 } |
|
191 |
|
192 @Override |
|
193 public void eUnset(EStructuralFeature feature) { |
|
194 |
|
195 } |
|
196 |
|
197 @Override |
|
198 public EList<Adapter> eAdapters() { |
|
199 return null; |
|
200 } |
|
201 |
|
202 @Override |
|
203 public boolean eDeliver() { |
|
204 return false; |
|
205 } |
|
206 |
|
207 @Override |
|
208 public void eNotify(Notification notification) { |
|
209 |
|
210 } |
|
211 |
|
212 @Override |
|
213 public void eSetDeliver(boolean deliver) { |
|
214 |
|
215 } |
|
216 |
|
217 } |
|
218 } |