3 * Copyright (C) 2014 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.taxeditor
.httpinvoker
;
13 import java
.io
.IOException
;
14 import java
.net
.URISyntaxException
;
17 import org
.apache
.log4j
.Logger
;
18 import org
.eclipse
.core
.runtime
.FileLocator
;
19 import org
.eclipse
.core
.runtime
.Platform
;
20 import org
.junit
.Assert
;
21 import org
.junit
.Ignore
;
22 import org
.junit
.Test
;
23 import org
.osgi
.framework
.Bundle
;
25 import eu
.etaxonomy
.taxeditor
.remoting
.server
.CDMServerUtils
;
26 import eu
.etaxonomy
.taxeditor
.webapp
.CDMEmbeddedServerException
;
27 import eu
.etaxonomy
.taxeditor
.webapp
.CDMServer
;
28 import eu
.etaxonomy
.taxeditor
.webapp
.ICDMServerError
;
36 public class CdmServerTest
extends TestConfig
{
37 private static final Logger logger
= Logger
.getLogger(CdmServerTest
.class);
42 public void generateConfigFile() throws IOException
{
43 String mgdServerConfigFileName
= "test.mgd.datasources.xml";
44 String config
= CDMServerUtils
.convertEditorToServerConfig();
45 CDMServerUtils
.writeManagedServerConfig(config
, mgdServerConfigFileName
);
50 //FIXME: remove @ignore and fix test
51 public void manageCdmServer() throws IOException
, URISyntaxException
, CDMEmbeddedServerException
{
52 Bundle bundle
= Platform
.getBundle("eu.etaxonomy.taxeditor.test");
53 URL mgdDatasourcesConfigURL
= bundle
.getEntry("src/test/resources/.cdmLibrary/writableResources/mgd.datasources.xml");
54 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());
64 } catch (Exception e
) {
66 Assert
.fail("Error stopping server. Reason : " + e
.getMessage());