Project

General

Profile

« Previous | Next » 

Revision 7bc01856

Added by Cherian Mathew over 8 years ago

Add test for editor / server cdmlib version check

View differences:

eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/source/CdmServerInfo.java
296 296
    }
297 297

  
298 298
    public int compareCdmlibServicesVersion() throws CdmSourceException {
299
        int result = 0;
299

  
300 300
        String serverVersion = cdmlibServicesVersion;
301
        String serverCdmlibLastModified = cdmlibServicesLastModified;
302

  
303
        return compareCdmlibServicesVersion(serverVersion, serverCdmlibLastModified);
304
    }
305

  
306

  
307
    /**
308
     * @param serverVersion
309
     * @param editorVersion
310
     * @throws CdmSourceException
311
     */
312
    public static int compareCdmlibServicesVersion(String serverVersion, String serverCdmlibLastModified) throws CdmSourceException {
313

  
301 314
        String editorVersion = CdmApplicationState.getCdmlibVersion();
315
        String editorCdmlibLastModified = CdmApplicationState.getCdmlibLastModified();
302 316

  
317
        int result = 0;
303 318
        if(StringUtils.isBlank(serverVersion) || StringUtils.isBlank(editorVersion)) {
304 319
            throw new CdmSourceException("cdmlib-services server or editor version is empty");
305 320
        }
......
325 340
        }
326 341
        // at this point major, minor and patch versions are matching
327 342

  
328
        if(StringUtils.isBlank(cdmlibServicesLastModified) || StringUtils.isBlank(CdmApplicationState.getCdmlibLastModified())) {
343
        if(StringUtils.isBlank(serverCdmlibLastModified) || StringUtils.isBlank(editorCdmlibLastModified)) {
329 344
            throw new CdmSourceException("cdmlib-services server or editor version is empty");
330 345
        }
331 346

  
332 347
        String cdmServerIgnoreVersion = System.getProperty("cdm.server.version.lm.ignore");
333 348
        if(StringUtils.isBlank(cdmServerIgnoreVersion) || !cdmServerIgnoreVersion.equals("true")) {
334
            Long serverLastModified = Long.valueOf(cdmlibServicesLastModified);
335
            Long editorLastModified = Long.valueOf(CdmApplicationState.getCdmlibLastModified());
349
            Long serverLastModified = Long.valueOf(serverCdmlibLastModified);
350
            Long editorLastModified = Long.valueOf(editorCdmlibLastModified);
336 351
            return serverLastModified.compareTo(editorLastModified);
337 352
        }
338 353

  
339 354
        return 0;
340

  
341 355
    }
342 356

  
357

  
358

  
343 359
    public static List<CdmServerInfo> getCdmServers() {
344 360
        if(cdmServerInfoList == null) {
345 361
            cdmServerInfoList = new ArrayList<CdmServerInfo>();

Also available in: Unified diff