From d4d342a192d3eeabca90960d3a87f69aae31d218 Mon Sep 17 00:00:00 2001 From: Cherian Mathew Date: Wed, 7 Oct 2015 16:43:53 +0200 Subject: [PATCH] #5302 Add cdm version and services version check --- .../api/application/CdmApplicationState.java | 74 ++++++++- .../remoting/source/CdmServerInfo.java | 154 +++++++++++++++--- .../session/DefaultNewEntityListener.java | 2 +- .../ui/dialog/RemotingLoginDialog.java | 129 ++++++++++++--- .../operation/TaxonNameEditorTest.java | 1 - .../session/CdmApplicationStateTest.java | 31 ++++ 6 files changed, 343 insertions(+), 48 deletions(-) create mode 100644 eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/session/CdmApplicationStateTest.java diff --git a/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/CdmApplicationState.java b/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/CdmApplicationState.java index bcd6dff64..e9e489a53 100644 --- a/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/CdmApplicationState.java +++ b/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/CdmApplicationState.java @@ -9,10 +9,24 @@ */ package eu.etaxonomy.cdm.api.application; +import java.io.File; +import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Type; - +import java.net.URISyntaxException; +import java.net.URL; +import java.util.Dictionary; +import java.util.jar.Attributes; +import java.util.jar.JarFile; +import java.util.jar.Manifest; + +import org.eclipse.core.runtime.FileLocator; +import org.eclipse.core.runtime.Platform; +import org.eclipse.osgi.util.ManifestElement; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleException; +import org.osgi.framework.Constants; import org.springframework.security.core.context.SecurityContext; import eu.etaxonomy.cdm.api.cache.CdmServiceCacher; @@ -41,6 +55,8 @@ public class CdmApplicationState { private static CdmServiceCacher cdmServiceCacher; + private static String cdmlibVersion = null; + private static String cdmlibLastModified = null; public static CdmApplicationState getInstance() { if(cdmApplicationState == null) { @@ -129,6 +145,8 @@ public class CdmApplicationState { getInstance().setSecurityContext(null); cdmApplicationState = null; cdmServiceCacher = null; + cdmlibVersion = null; + cdmlibLastModified = null; } @@ -211,5 +229,59 @@ public class CdmApplicationState { cdmServiceCacher = cacher; } + public static void updateCdmlibManifestInfo() { + cdmlibVersion = null; + cdmlibLastModified = null; + String cdmlibPathPrefix = "lib/cdmlib-services-"; + String jarSuffix = ".jar"; + Bundle bundle = Platform.getBundle("eu.etaxonomy.taxeditor.cdmlib"); + Dictionary headers = bundle.getHeaders(); + String bundleClasspath = headers.get(Constants.BUNDLE_CLASSPATH); + try { + ManifestElement[] elements = ManifestElement.parseHeader(Constants.BUNDLE_CLASSPATH, bundleClasspath); + for (ManifestElement manifestElement : elements) { + String jar = manifestElement.getValue(); + if(jar.startsWith(cdmlibPathPrefix) && jar.endsWith(jarSuffix)) { + URL fileURL = bundle.getEntry(jar); + File file = null; + try { + file = new File(FileLocator.resolve(fileURL).toURI()); + JarFile jarFile = new JarFile(file); + Manifest manifest = jarFile.getManifest(); + Attributes attributes = manifest.getMainAttributes(); + // from the OSGI spec the LastModified value is " the number of milliseconds + // since midnight Jan. 1, 1970 UTC with the condition that a change must + // always result in a higher value than the previous last modified time + // of any bundle" + cdmlibVersion = attributes.getValue("Bundle-Version"); + cdmlibLastModified = attributes.getValue("Bnd-LastModified"); + + if(cdmlibVersion == null || cdmlibLastModified == null) { + throw new IllegalStateException("Invalid cdmlib manifest info"); + } + } catch (URISyntaxException urise) { + throw new IllegalStateException(urise); + } catch (IOException ioe) { + throw new IllegalStateException(ioe); + } + } + } + } catch (BundleException e) { + throw new IllegalStateException(e); + } + } + + public static String getCdmlibVersion() { + if(cdmlibVersion == null) { + updateCdmlibManifestInfo(); + } + return cdmlibVersion; + } + public static String getCdmlibLastModified() { + if(cdmlibLastModified == null) { + updateCdmlibManifestInfo(); + } + return cdmlibLastModified; + } } diff --git a/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/source/CdmServerInfo.java b/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/source/CdmServerInfo.java index d6fce9ba0..e5822e9eb 100644 --- a/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/source/CdmServerInfo.java +++ b/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/source/CdmServerInfo.java @@ -16,6 +16,7 @@ import java.util.Collections; import java.util.Comparator; import java.util.List; +import org.apache.commons.lang.StringUtils; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.ClientProtocolException; @@ -23,15 +24,19 @@ import org.apache.http.client.HttpClient; import org.apache.http.client.ResponseHandler; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.DefaultHttpClient; +import org.apache.http.params.HttpConnectionParams; +import org.apache.http.params.HttpParams; import org.apache.http.util.EntityUtils; import org.apache.log4j.Logger; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; +import eu.etaxonomy.cdm.api.application.CdmApplicationState; import eu.etaxonomy.cdm.config.CdmSourceException; import eu.etaxonomy.cdm.database.CdmPersistentDataSource; import eu.etaxonomy.cdm.database.ICdmDataSource; +import eu.etaxonomy.cdm.model.metadata.CdmMetaData; import eu.etaxonomy.taxeditor.remoting.server.CDMServerException; /** @@ -75,11 +80,16 @@ public class CdmServerInfo { private static List cdmServerInfoList; + private String cdmlibServicesVersion = ""; + private String cdmlibServicesLastModified = ""; + + public CdmServerInfo(String name, String server, int port) { this.name = name; this.server = server; this.port = port; instances = new ArrayList(); + } @@ -98,6 +108,14 @@ public class CdmServerInfo { return NAME_LOCALHOST_MGD.equals(name); } + public String getCdmlibServicesVersion() { + return cdmlibServicesVersion; + } + + public String getCdmlibLastModified() { + return cdmlibServicesLastModified; + } + public void refreshInstances() throws CDMServerException { instances.clear(); if(isLocalhostMgd()) { @@ -114,10 +132,54 @@ public class CdmServerInfo { }); } + public void updateInfo() throws CDMServerException { + String url = "http://" + server + ":" + String.valueOf(port) + "/" + CDMSERVER_PREFIX + "/info.jsp"; + String responseBody = getResponse(url); + if(responseBody != null) { + try { + JSONObject info = new JSONObject(responseBody); + cdmlibServicesVersion = info.getString("cdmlibServicesVersion"); + cdmlibServicesLastModified = info.getString("cdmlibServicesLastModified"); + } catch (JSONException e) { + throw new CDMServerException(e); + } + } + } + public void addInstancesViaHttp() throws CDMServerException { + updateInfo(); String url = "http://" + server + ":" + String.valueOf(port) + "/" + CDMSERVER_PREFIX + "/instances.jsp"; + String responseBody = getResponse(url); + if(responseBody != null) { + try { + JSONArray array = new JSONArray(responseBody); + for(int i=0;i 4 || editorVersionSplit.length > 4) { + throw new CdmSourceException("cdmlib-services server or editor version is invalid"); + } + + Integer serverVersionPart; + Integer editorVersionPart; + + for(int i=0 ; i<3 ; i++) { + serverVersionPart = Integer.valueOf(serverVersionSplit[i]); + editorVersionPart = Integer.valueOf(editorVersionSplit[i]); + + int partCompare = serverVersionPart.compareTo(editorVersionPart); + if (partCompare != 0){ + return partCompare; + } + } + // at this point major, minor and patch versions are matching + + if(StringUtils.isBlank(cdmlibServicesLastModified) || StringUtils.isBlank(CdmApplicationState.getCdmlibLastModified())) { + throw new CdmSourceException("cdmlib-services server or editor version is empty"); + } + + String cdmServerIgnoreVersion = System.getProperty("cdm.server.version.lm.ignore"); + if(StringUtils.isBlank(cdmServerIgnoreVersion) || !cdmServerIgnoreVersion.equals("true")) { + Long serverLastModified = Long.valueOf(cdmlibServicesLastModified); + Long editorLastModified = Long.valueOf(CdmApplicationState.getCdmlibLastModified()); + return serverLastModified.compareTo(editorLastModified); + } + + return 0; + + } + public static List getCdmServers() { if(cdmServerInfoList == null) { cdmServerInfoList = new ArrayList(); diff --git a/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/session/DefaultNewEntityListener.java b/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/session/DefaultNewEntityListener.java index aaf23e9ef..7ce1808ac 100644 --- a/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/session/DefaultNewEntityListener.java +++ b/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/session/DefaultNewEntityListener.java @@ -30,7 +30,7 @@ public class DefaultNewEntityListener implements NewEntityListener { */ @Override public void onCreate(CdmBase cdmBase) { - logger.warn("New Entity created : " + cdmBase); + logger.info("New Entity created : " + cdmBase); if(CdmApplicationState.getCurrentAppConfig() instanceof CdmApplicationRemoteController){ ((CdmApplicationRemoteController)CdmApplicationState.getCurrentAppConfig()).getCdmEntitySessionManager().getActiveSession().addNewCdmEntity(cdmBase); } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/RemotingLoginDialog.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/RemotingLoginDialog.java index 9d56c4da2..0a6b84b32 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/RemotingLoginDialog.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/RemotingLoginDialog.java @@ -9,10 +9,13 @@ */ package eu.etaxonomy.taxeditor.ui.dialog; +import java.text.SimpleDateFormat; +import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; +import org.apache.commons.lang.StringUtils; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; @@ -44,6 +47,8 @@ import org.eclipse.wb.swt.SWTResourceManager; import org.osgi.service.prefs.BackingStoreException; import org.osgi.service.prefs.Preferences; +import eu.etaxonomy.cdm.api.application.CdmApplicationState; +import eu.etaxonomy.cdm.model.metadata.CdmMetaData; import eu.etaxonomy.taxeditor.model.MessagingUtils; import eu.etaxonomy.taxeditor.remoting.server.CDMServerException; import eu.etaxonomy.taxeditor.remoting.source.CdmRemoteSource; @@ -76,6 +81,11 @@ public class RemotingLoginDialog extends Dialog { private final static String STATUS_NO_INSTANCES = "No Instances Found"; private final static String STATUS_ERROR = "Error"; private final static String STATUS_REMOTING_NOT_ACTIVATED = "Remoting not activated"; + private final static String STATUS_NOT_COMPATIBLE = "Not Compatible"; + + private final static String MESG_COMPATIBLE_EDITOR_OLD = "Please update the Taxonomic Editor (Help->Check for Updates) or choose a compatible cdm-server"; + private final static String MESG_COMPATIBLE_SERVER_OLD = "Please update the chosen cdm-server or choose a compatible cdm-server"; + private final static String STORE_PREFERENCES_NODE = "eu.etaxonomy.taxeditor.store"; private final static String LOGIN_NODE = "login"; @@ -108,7 +118,7 @@ public class RemotingLoginDialog extends Dialog { private final int MIN_WIDTH = 530; private final int MIN_HEIGHT = 220; - private final int MIN_EXP_HEIGHT = 350; + private final int MIN_EXP_HEIGHT = 380; private final int MESSAGE_HEIGHT = 25; private Label lblEditorVersion; private Text txtEditorVersion; @@ -163,6 +173,7 @@ public class RemotingLoginDialog extends Dialog { readPrefLastServerInstance(); } + setEditorInfo(); populateCdmServerCombo(); shlConnect.open(); shlConnect.layout(); @@ -385,11 +396,10 @@ public class RemotingLoginDialog extends Dialog { lblServerVersion = new Label(compAdvanced, SWT.CENTER); lblServerVersion.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); - lblServerVersion.setText("Server Version :"); + lblServerVersion.setText("Server Cdmlib Version :"); lblServerVersion.setFont(SWTResourceManager.getFont("Ubuntu", 9, SWT.NORMAL)); txtServerVersion = new Text(compAdvanced, SWT.BORDER); - txtServerVersion.setEnabled(false); txtServerVersion.setEditable(false); txtServerVersion.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); new Label(compAdvanced, SWT.NONE); @@ -397,11 +407,10 @@ public class RemotingLoginDialog extends Dialog { lblEditorVersion = new Label(compAdvanced, SWT.CENTER); lblEditorVersion.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); - lblEditorVersion.setText("Editor Version :"); + lblEditorVersion.setText("Editor Cdmlib Version :"); lblEditorVersion.setFont(SWTResourceManager.getFont("Ubuntu", 9, SWT.NORMAL)); txtEditorVersion = new Text(compAdvanced, SWT.BORDER); - txtEditorVersion.setEnabled(false); txtEditorVersion.setEditable(false); txtEditorVersion.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); new Label(compAdvanced, SWT.NONE); @@ -413,7 +422,6 @@ public class RemotingLoginDialog extends Dialog { lblServerCDMVersion.setFont(SWTResourceManager.getFont("Ubuntu", 9, SWT.NORMAL)); txtServerCDMVersion = new Text(compAdvanced, SWT.BORDER); - txtServerCDMVersion.setEnabled(false); txtServerCDMVersion.setEditable(false); txtServerCDMVersion.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); new Label(compAdvanced, SWT.NONE); @@ -425,7 +433,6 @@ public class RemotingLoginDialog extends Dialog { lblEditorCDMVersion.setFont(SWTResourceManager.getFont("Ubuntu", 9, SWT.NORMAL)); txtEditorCDMVersion = new Text(compAdvanced, SWT.BORDER); - txtEditorCDMVersion.setEnabled(false); txtEditorCDMVersion.setEditable(false); txtEditorCDMVersion.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); @@ -511,9 +518,7 @@ public class RemotingLoginDialog extends Dialog { private void checkSelectedCdmServer() { - txtCdmInstanceStatus.setText(""); - txtPort.setEditable(false); - txtPort.setEnabled(false); + clearOnServerChange(); emptyCredentials(); if(selectedCsii != null) { @@ -524,6 +529,8 @@ public class RemotingLoginDialog extends Dialog { if(selectedCsii.pingServer()) { txtCdmServerStatus.setText(STATUS_AVAILABLE); populateCdmInstanceCombo(true); + txtServerVersion.setText(selectedCsii.getCdmlibServicesVersion()); + txtServerVersion.setToolTipText(generateLastModifiedTooltip(selectedCsii.getCdmlibLastModified())); } else { txtCdmServerStatus.setText(STATUS_NOT_AVAILABLE); @@ -538,6 +545,7 @@ public class RemotingLoginDialog extends Dialog { comboCdmInstance.setEnabled(false); btnConnect.setEnabled(false); txtCdmInstanceStatus.setText(STATUS_RETRIEVING); + txtCdmInstanceStatus.setToolTipText(""); Job job = new Job("Retrieve Server Instances") { @Override @@ -579,12 +587,13 @@ public class RemotingLoginDialog extends Dialog { } }); } - } catch (CDMServerException e) { + } catch (final CDMServerException e) { MessagingUtils.warn(getClass(), e); Display.getDefault().asyncExec(new Runnable() { @Override public void run() { - txtCdmInstanceStatus.setText(STATUS_REMOTING_NOT_ACTIVATED); + txtCdmInstanceStatus.setText(STATUS_NOT_AVAILABLE); + txtCdmInstanceStatus.setToolTipText(e.getMessage()); comboCdmInstance.setEnabled(false); btnConnect.setEnabled(false); } @@ -603,6 +612,7 @@ public class RemotingLoginDialog extends Dialog { private void refreshCdmInstance() { txtCdmInstanceStatus.setText(STATUS_CHECKING_AVAILABILITY); + clearOnInstanceChange(); updateSelectedCdmInstance(); checkSelectedCdmInstance(); } @@ -618,19 +628,52 @@ public class RemotingLoginDialog extends Dialog { } private void checkSelectedCdmInstance() { + boolean available = false; + String status = STATUS_NOT_AVAILABLE; + String message = null; + if(txtCdmServerStatus.getText().equals(STATUS_AVAILABLE)) { try { if(selectedCsii.pingInstance(selectedCdmInstance, getPort())) { - txtCdmInstanceStatus.setText(STATUS_AVAILABLE); - btnConnect.setEnabled(true); + status = STATUS_AVAILABLE; + available = true; } else { - txtCdmInstanceStatus.setText(STATUS_NOT_AVAILABLE); - btnConnect.setEnabled(false); + status = STATUS_NOT_AVAILABLE; + available = false; + } + + if(available) { + txtServerCDMVersion.setText(selectedCsii.getCdmRemoteSource(selectedCdmInstance, getPort()).getDbSchemaVersion()); + int compareDbSchemaVersion = selectedCsii.compareDbSchemaVersion(selectedCdmInstance, getPort()); + int compareCdmlibServicesVersion = selectedCsii.compareCdmlibServicesVersion(); + + if(compareDbSchemaVersion > 0 || compareCdmlibServicesVersion > 0) { + status = STATUS_NOT_COMPATIBLE; + available = false; + message = MESG_COMPATIBLE_EDITOR_OLD; + } else if(compareDbSchemaVersion < 0 || compareCdmlibServicesVersion < 0) { + status = STATUS_NOT_COMPATIBLE; + available = false; + message = MESG_COMPATIBLE_SERVER_OLD; + } else { + status = STATUS_AVAILABLE; + available = true; + message = ""; + } + + } + } catch (Exception e) { - txtCdmInstanceStatus.setText(STATUS_NOT_AVAILABLE); txtCdmInstanceStatus.setToolTipText(e.getMessage()); + } finally { + btnConnect.setEnabled(available); + txtCdmInstanceStatus.setText(status); + if(!StringUtils.isBlank(message)) { + setMessage(message); + } } + } } @@ -751,18 +794,25 @@ public class RemotingLoginDialog extends Dialog { styledTxtMessage.setText(message); styledTxtMessage.setVisible(true); ((GridData)styledTxtMessage.getLayoutData()).exclude = false; - shlConnect.setSize(MIN_WIDTH, MIN_HEIGHT+MESSAGE_HEIGHT); - shlConnect.setMinimumSize(MIN_WIDTH, MIN_HEIGHT+MESSAGE_HEIGHT); + shlConnect.setSize(MIN_WIDTH, getHeightWithoutMessage() + MESSAGE_HEIGHT); + shlConnect.setMinimumSize(MIN_WIDTH, getHeightWithoutMessage() + MESSAGE_HEIGHT); } else { styledTxtMessage.setText(""); styledTxtMessage.setVisible(false); ((GridData)styledTxtMessage.getLayoutData()).exclude = true; - shlConnect.setSize(MIN_WIDTH, MIN_HEIGHT); - shlConnect.setMinimumSize(MIN_WIDTH, MIN_HEIGHT); + shlConnect.setSize(MIN_WIDTH, getHeightWithoutMessage()); + shlConnect.setMinimumSize(MIN_WIDTH, getHeightWithoutMessage()); } remotingComposite.layout(); } + private int getHeightWithoutMessage() { + if(xpndblcmpstAdvanced.isExpanded()) { + return MIN_EXP_HEIGHT; + } else { + return MIN_HEIGHT; + } + } public void hide(boolean isHidden) { @@ -790,4 +840,41 @@ public class RemotingLoginDialog extends Dialog { } }); } + + private String generateLastModifiedTooltip(String cdmlibLastModified) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd 'at' HH:mm:ss z"); + Date cdmlibLastModifiedDate; + String cdmlibLastModifiedTimestamp = ""; + + cdmlibLastModifiedDate = new Date(Long.valueOf(cdmlibLastModified)); + cdmlibLastModifiedTimestamp = sdf.format(cdmlibLastModifiedDate); + + return "last modified : " + cdmlibLastModifiedTimestamp; + } + + private void setEditorInfo() { + txtEditorCDMVersion.setText(CdmMetaData.getDbSchemaVersion()); + txtEditorVersion.setText(CdmApplicationState.getCdmlibVersion()); + txtEditorVersion.setToolTipText(generateLastModifiedTooltip(CdmApplicationState.getCdmlibLastModified())); + } + + private void clearOnServerChange() { + setMessage(""); + txtServerCDMVersion.setText(""); + txtServerVersion.setText(""); + txtServerVersion.setToolTipText(""); + txtServerCDMVersion.setText(""); + txtPort.setEditable(false); + txtPort.setEnabled(false); + } + + private void clearOnInstanceChange() { + setMessage(""); + txtServerCDMVersion.setText(""); + } + + private void updateOnServerChange(String serverVersion, String serverVersionTooltip) { + + } + } diff --git a/eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/operation/TaxonNameEditorTest.java b/eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/operation/TaxonNameEditorTest.java index baafa0718..77fc90f0c 100644 --- a/eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/operation/TaxonNameEditorTest.java +++ b/eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/operation/TaxonNameEditorTest.java @@ -193,7 +193,6 @@ public class TaxonNameEditorTest extends BaseOperationTest { Taxon grandChildTaxon = Taxon.NewInstance(null, null); TaxonNode grandChildTaxonNode = childTaxonNode.addChildTaxon(grandChildTaxon, null, null); - CdmStore.getService(ITaxonNodeService.class).merge(taxonNode,true); Assert.assertEquals(taxonNode.getChildNodes().get(0).getId(), childTaxonNode.getId()); diff --git a/eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/session/CdmApplicationStateTest.java b/eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/session/CdmApplicationStateTest.java new file mode 100644 index 000000000..f09d37a9b --- /dev/null +++ b/eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/session/CdmApplicationStateTest.java @@ -0,0 +1,31 @@ +// $Id$ +/** +* Copyright (C) 2015 EDIT +* European Distributed Institute of Taxonomy +* http://www.e-taxonomy.eu +* +* The contents of this file are subject to the Mozilla Public License Version 1.1 +* See LICENSE.TXT at the top of this package for the full license terms. +*/ +package eu.etaxonomy.taxeditor.session; + +import org.junit.Test; +import org.springframework.util.Assert; +import org.unitils.UnitilsJUnit4; + +import eu.etaxonomy.cdm.api.application.CdmApplicationState; + +/** + * @author cmathew + * @date 5 Oct 2015 + * + */ +public class CdmApplicationStateTest extends UnitilsJUnit4 { + + @Test + public void testCdmlibManifestInfoUpdate() { + CdmApplicationState.updateCdmlibManifestInfo(); + Assert.notNull(CdmApplicationState.getCdmlibVersion()); + Assert.notNull(CdmApplicationState.getCdmlibLastModified()); + } +} -- 2.34.1