Package: TestServiceProvider$Service1

TestServiceProvider$Service1

nameinstructionbranchcomplexitylinemethod
TestServiceProvider.Service1(TestServiceProvider)
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getLongSignature()
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getName()
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getNumberOfParameters()
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getParameterTypes(IReadOnlyQueryEnvironment)
M: 16 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
getPriority()
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getShortSignature()
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getType(Call, ValidationServices, IValidationResult, IReadOnlyQueryEnvironment, List)
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
internalInvoke(Object[])
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2015 Obeo.
3: * All rights reserved. This program and the accompanying materials
4: * are made available under the terms of the Eclipse Public License v1.0
5: * which accompanies this distribution, and is available at
6: * http://www.eclipse.org/legal/epl-v10.html
7: *
8: * Contributors:
9: * Obeo - initial API and implementation
10: *******************************************************************************/
11: package org.eclipse.acceleo.query.tests.runtime.lookup.basic;
12:
13: import java.util.ArrayList;
14: import java.util.List;
15: import java.util.Set;
16:
17: import org.eclipse.acceleo.query.ast.Call;
18: import org.eclipse.acceleo.query.runtime.IReadOnlyQueryEnvironment;
19: import org.eclipse.acceleo.query.runtime.IService;
20: import org.eclipse.acceleo.query.runtime.IServiceProvider;
21: import org.eclipse.acceleo.query.runtime.IValidationResult;
22: import org.eclipse.acceleo.query.runtime.impl.AbstractService;
23: import org.eclipse.acceleo.query.runtime.impl.ValidationServices;
24: import org.eclipse.acceleo.query.validation.type.ClassType;
25: import org.eclipse.acceleo.query.validation.type.IType;
26:
27: /**
28: * Lower priority lower type {@link IServiceProvider}.
29: *
30: * @author <a href="mailto:yvan.lussaud@obeo.fr">Yvan Lussaud</a>
31: */
32: public class TestServiceProvider implements IServiceProvider {
33:
34:         public static final String SERVICE_NAME = "service";
35:
36:         public class Service1 extends AbstractService {
37:
38:                 /**
39:                  * {@inheritDoc}
40:                  *
41:                  * @see org.eclipse.acceleo.query.runtime.IService#getName()
42:                  */
43:                 @Override
44:                 public String getName() {
45:                         return SERVICE_NAME;
46:                 }
47:
48:                 /**
49:                  * {@inheritDoc}
50:                  *
51:                  * @see org.eclipse.acceleo.query.runtime.IService#getShortSignature()
52:                  */
53:                 @Override
54:                 public String getShortSignature() {
55:                         return SERVICE_NAME;
56:                 }
57:
58:                 /**
59:                  * {@inheritDoc}
60:                  *
61:                  * @see org.eclipse.acceleo.query.runtime.IService#getLongSignature()
62:                  */
63:                 @Override
64:                 public String getLongSignature() {
65:                         return SERVICE_NAME;
66:                 }
67:
68:                 /**
69:                  * {@inheritDoc}
70:                  *
71:                  * @see org.eclipse.acceleo.query.runtime.IService#getParameterTypes(org.eclipse.acceleo.query.runtime.IReadOnlyQueryEnvironment)
72:                  */
73:                 @Override
74:                 public List<IType> getParameterTypes(IReadOnlyQueryEnvironment queryEnvironment) {
75:                         final List<IType> result = new ArrayList<IType>();
76:
77:                         result.add(new ClassType(queryEnvironment, type1));
78:
79:                         return result;
80:                 }
81:
82:                 /**
83:                  * {@inheritDoc}
84:                  *
85:                  * @see org.eclipse.acceleo.query.runtime.IService#getNumberOfParameters()
86:                  */
87:                 @Override
88:                 public int getNumberOfParameters() {
89:                         return 1;
90:                 }
91:
92:                 /**
93:                  * {@inheritDoc}
94:                  *
95:                  * @see org.eclipse.acceleo.query.runtime.IService#getPriority()
96:                  */
97:                 @Override
98:                 public int getPriority() {
99:                         return priority1;
100:                 }
101:
102:                 /**
103:                  * {@inheritDoc}
104:                  *
105:                  * @see org.eclipse.acceleo.query.runtime.IService#getType(org.eclipse.acceleo.query.ast.Call,
106:                  * org.eclipse.acceleo.query.runtime.impl.ValidationServices,
107:                  * org.eclipse.acceleo.query.runtime.IValidationResult,
108:                  * org.eclipse.acceleo.query.runtime.IReadOnlyQueryEnvironment, java.util.List)
109:                  */
110:                 @Override
111:                 public Set<IType> getType(Call call, ValidationServices services, IValidationResult validationResult,
112:                                 IReadOnlyQueryEnvironment queryEnvironment, List<IType> argTypes) {
113:                         return null;
114:                 }
115:
116:                 /**
117:                  * {@inheritDoc}
118:                  *
119:                  * @see org.eclipse.acceleo.query.runtime.impl.AbstractService#internalInvoke(java.lang.Object[])
120:                  */
121:                 @Override
122:                 protected Object internalInvoke(Object[] arguments) throws Exception {
123:                         return null;
124:                 }
125:
126:         }
127:
128:         public class Service2 extends AbstractService {
129:
130:                 /**
131:                  * {@inheritDoc}
132:                  *
133:                  * @see org.eclipse.acceleo.query.runtime.IService#getName()
134:                  */
135:                 @Override
136:                 public String getName() {
137:                         return SERVICE_NAME;
138:                 }
139:
140:                 /**
141:                  * {@inheritDoc}
142:                  *
143:                  * @see org.eclipse.acceleo.query.runtime.IService#getShortSignature()
144:                  */
145:                 @Override
146:                 public String getShortSignature() {
147:                         return SERVICE_NAME;
148:                 }
149:
150:                 /**
151:                  * {@inheritDoc}
152:                  *
153:                  * @see org.eclipse.acceleo.query.runtime.IService#getLongSignature()
154:                  */
155:                 @Override
156:                 public String getLongSignature() {
157:                         return SERVICE_NAME;
158:                 }
159:
160:                 /**
161:                  * {@inheritDoc}
162:                  *
163:                  * @see org.eclipse.acceleo.query.runtime.IService#getParameterTypes(org.eclipse.acceleo.query.runtime.IReadOnlyQueryEnvironment)
164:                  */
165:                 @Override
166:                 public List<IType> getParameterTypes(IReadOnlyQueryEnvironment queryEnvironment) {
167:                         final List<IType> result = new ArrayList<IType>();
168:
169:                         result.add(new ClassType(queryEnvironment, type2));
170:
171:                         return result;
172:                 }
173:
174:                 /**
175:                  * {@inheritDoc}
176:                  *
177:                  * @see org.eclipse.acceleo.query.runtime.IService#getNumberOfParameters()
178:                  */
179:                 @Override
180:                 public int getNumberOfParameters() {
181:                         return 1;
182:                 }
183:
184:                 /**
185:                  * {@inheritDoc}
186:                  *
187:                  * @see org.eclipse.acceleo.query.runtime.IService#getPriority()
188:                  */
189:                 @Override
190:                 public int getPriority() {
191:                         return priority2;
192:                 }
193:
194:                 /**
195:                  * {@inheritDoc}
196:                  *
197:                  * @see org.eclipse.acceleo.query.runtime.IService#getType(org.eclipse.acceleo.query.ast.Call,
198:                  * org.eclipse.acceleo.query.runtime.impl.ValidationServices,
199:                  * org.eclipse.acceleo.query.runtime.IValidationResult,
200:                  * org.eclipse.acceleo.query.runtime.IReadOnlyQueryEnvironment, java.util.List)
201:                  */
202:                 @Override
203:                 public Set<IType> getType(Call call, ValidationServices services, IValidationResult validationResult,
204:                                 IReadOnlyQueryEnvironment queryEnvironment, List<IType> argTypes) {
205:                         return null;
206:                 }
207:
208:                 /**
209:                  * {@inheritDoc}
210:                  *
211:                  * @see org.eclipse.acceleo.query.runtime.impl.AbstractService#internalInvoke(java.lang.Object[])
212:                  */
213:                 @Override
214:                 protected Object internalInvoke(Object[] arguments) throws Exception {
215:                         return null;
216:                 }
217:
218:         }
219:
220:         private final int priority1;
221:
222:         private final Class<?> type1;
223:
224:         private final int priority2;
225:
226:         private final Class<?> type2;
227:
228:         public TestServiceProvider(int priority1, Class<?> type1, int priority2, Class<?> type2) {
229:                 this.priority1 = priority1;
230:                 this.type1 = type1;
231:                 this.priority2 = priority2;
232:                 this.type2 = type2;
233:         }
234:
235:         @Override
236:         public List<IService> getServices(IReadOnlyQueryEnvironment queryEnvironment) {
237:                 final List<IService> result = new ArrayList<IService>();
238:
239:                 result.add(new Service1());
240:                 result.add(new Service2());
241:
242:                 return result;
243:         }
244:
245: }