1149
1150 /**
1151 * Checks if serviceReader is active and file with service description does
1152 * exist.
1153 * @return true, if it's needed to start services, false otherwise.
1154 */
1155 public boolean needServices() {
1156 ServiceReader sr = getServiceReader();
1157 if (sr == null) {
1158 return false;
1159 }
1160
1161 /*
1162 * Since jt4.5 the ServiceReader has been extended with a new method.
1163 * To preserve ability to use new javatest with old test suites
1164 * the extra check is performed: check if the newly introduced method
1165 * is abstract or not.
1166 */
1167 boolean isLegacy = false;
1168 try {
1169 Method m = sr.getClass().getMethod("getServiceDescriptorFileName", new Class<?>[0]);
1170 if (Modifier.isAbstract(m.getModifiers())) {
1171 isLegacy = true;
1172 }
1173 } catch (NoSuchMethodException e) {
1174 isLegacy = true;
1175 }
1176 File descrFile = isLegacy ?
1177 new File(getRootDir(), File.separator + "lib" + File.separator + "services.xml") :
1178 new File(getRootDir(), sr.getServiceDescriptorFileName());
1179
1180 return descrFile.exists();
1181 }
1182 /**
1183 * Returns a test suite specific ServiceReader, used to read Service
1184 * definitions.
1185 *
1186 * @return ServiceReader instance. Default is PropertyServiceReader
1187 */
1188 public ServiceReader getServiceReader() {
1189 if (serviceReader != null) {
|
1149
1150 /**
1151 * Checks if serviceReader is active and file with service description does
1152 * exist.
1153 * @return true, if it's needed to start services, false otherwise.
1154 */
1155 public boolean needServices() {
1156 ServiceReader sr = getServiceReader();
1157 if (sr == null) {
1158 return false;
1159 }
1160
1161 /*
1162 * Since jt4.5 the ServiceReader has been extended with a new method.
1163 * To preserve ability to use new javatest with old test suites
1164 * the extra check is performed: check if the newly introduced method
1165 * is abstract or not.
1166 */
1167 boolean isLegacy = false;
1168 try {
1169 Method m = sr.getClass().getMethod("getServiceDescriptorFileName");
1170 if (Modifier.isAbstract(m.getModifiers())) {
1171 isLegacy = true;
1172 }
1173 } catch (NoSuchMethodException e) {
1174 isLegacy = true;
1175 }
1176 File descrFile = isLegacy ?
1177 new File(getRootDir(), File.separator + "lib" + File.separator + "services.xml") :
1178 new File(getRootDir(), sr.getServiceDescriptorFileName());
1179
1180 return descrFile.exists();
1181 }
1182 /**
1183 * Returns a test suite specific ServiceReader, used to read Service
1184 * definitions.
1185 *
1186 * @return ServiceReader instance. Default is PropertyServiceReader
1187 */
1188 public ServiceReader getServiceReader() {
1189 if (serviceReader != null) {
|