2 * Copyright (C) 2014 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
9 package eu
.etaxonomy
.taxeditor
.httpinvoker
;
12 import java
.io
.IOException
;
13 import java
.net
.URISyntaxException
;
16 import org
.apache
.log4j
.Logger
;
17 import org
.eclipse
.core
.runtime
.FileLocator
;
18 import org
.eclipse
.core
.runtime
.Platform
;
19 import org
.junit
.Assert
;
20 import org
.junit
.Ignore
;
21 import org
.junit
.Test
;
22 import org
.osgi
.framework
.Bundle
;
24 import eu
.etaxonomy
.taxeditor
.remoting
.server
.CdmServerUtils
;
25 import eu
.etaxonomy
.taxeditor
.webapp
.CdmServer
;
26 import eu
.etaxonomy
.taxeditor
.workbench
.datasource
.CdmEmbeddedServerException
;
27 import eu
.etaxonomy
.taxeditor
.workbench
.datasource
.ICdmServerError
;
35 public class CdmServerTest
extends TestConfig
{
37 @SuppressWarnings("unused")
38 private static final Logger logger
= Logger
.getLogger(CdmServerTest
.class);
41 public void generateConfigFile() throws IOException
{
42 String mgdServerConfigFileName
= "test.mgd.datasources.xml";
43 String config
= CdmServerUtils
.convertEditorToServerConfig();
44 CdmServerUtils
.writeManagedServerConfig(config
, mgdServerConfigFileName
);
49 //FIXME: remove @ignore and fix test #5632
50 public void manageCdmServer() throws IOException
, URISyntaxException
, CdmEmbeddedServerException
{
51 Bundle bundle
= Platform
.getBundle("eu.etaxonomy.taxeditor.test");
52 URL mgdDatasourcesConfigURL
= bundle
.getEntry("src/test/resources/.cdmLibrary/writableResources/mgd.datasources.xml");
53 File mgdDatasourcesConfigFile
= new File(FileLocator
.resolve(mgdDatasourcesConfigURL
).toURI());
55 CdmServer cdmServer
= new CdmServer("cdmTest", mgdDatasourcesConfigFile
);
56 cdmServer
.start(new ICdmServerError() {
58 public void handleError(Throwable t
) {
59 Assert
.fail("Error starting server. Reason : " + t
.getMessage());
63 }catch( CdmEmbeddedServerException cese
){
64 cese
.printStackTrace();
65 Assert
.fail("Error instantiating server. Reason: " + cese
.getMessage());
66 }catch (Exception e
) {
68 Assert
.fail("Error stopping server. Reason : " + e
.getMessage());