You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openmeetings.apache.org by so...@apache.org on 2018/03/09 11:42:30 UTC
[openmeetings] branch OPENMEETINGS-1649-kurento updated:
[OPENMEETINGS-1649] build seems to be fixed
This is an automated email from the ASF dual-hosted git repository.
solomax pushed a commit to branch OPENMEETINGS-1649-kurento
in repository https://gitbox.apache.org/repos/asf/openmeetings.git
The following commit(s) were added to refs/heads/OPENMEETINGS-1649-kurento by this push:
new b01521b [OPENMEETINGS-1649] build seems to be fixed
b01521b is described below
commit b01521b565393c0b0c492818fc8b2c2d4a01e99c
Author: Maxim Solodovnik <so...@gmail.com>
AuthorDate: Fri Mar 9 18:42:19 2018 +0700
[OPENMEETINGS-1649] build seems to be fixed
---
.../record/listener/async/BaseStreamWriter.java | 2 +-
.../openmeetings/core/remote/KurentoHandler.java | 4 +-
.../core/remote/ScopeApplicationAdapter.java | 18 ++++---
.../db/dao/basic/ConfigurationDao.java | 48 ++---------------
.../src/site/xdoc/BuildInstructions.xml | 1 +
openmeetings-util/pom.xml | 5 ++
openmeetings-web/pom.xml | 20 ++------
.../apache/openmeetings/web/app/Application.java | 8 +--
.../WEB-INF/{ => classes}/applicationContext.xml | 0
.../main/webapp/WEB-INF/classes/logback-config.xml | 31 +++++------
openmeetings-web/src/main/webapp/WEB-INF/web.xml | 4 ++
.../webservice/AbstractWebServiceTest.java | 60 ++++++++++------------
.../src/test/resources/logback-test.xml | 35 +++++--------
13 files changed, 88 insertions(+), 148 deletions(-)
diff --git a/openmeetings-core/src/main/java/org/apache/openmeetings/core/data/record/listener/async/BaseStreamWriter.java b/openmeetings-core/src/main/java/org/apache/openmeetings/core/data/record/listener/async/BaseStreamWriter.java
index effad74..bd95c65 100644
--- a/openmeetings-core/src/main/java/org/apache/openmeetings/core/data/record/listener/async/BaseStreamWriter.java
+++ b/openmeetings-core/src/main/java/org/apache/openmeetings/core/data/record/listener/async/BaseStreamWriter.java
@@ -72,7 +72,7 @@ public abstract class BaseStreamWriter implements Runnable {
}
*/
- /**
+ /*
* Initialization
*
* @throws IOException
diff --git a/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/KurentoHandler.java b/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/KurentoHandler.java
index c403209..bf593a2 100644
--- a/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/KurentoHandler.java
+++ b/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/KurentoHandler.java
@@ -98,8 +98,8 @@ public class KurentoHandler {
/**
* Looks for a room in the active room list.
*
- * @param roomName
- * the name of the room
+ * @param roomId
+ * the Id of the room
* @return the room if it was already created, or a new one if it is the first
* time this room is accessed
*/
diff --git a/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/ScopeApplicationAdapter.java b/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/ScopeApplicationAdapter.java
index 967faed..9a9c0ac 100644
--- a/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/ScopeApplicationAdapter.java
+++ b/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/ScopeApplicationAdapter.java
@@ -277,7 +277,7 @@ public class ScopeApplicationAdapter /*extends MultiThreadedApplicationAdapter i
}
*/
- /**
+ /*
*
* @param map - {@link Map} with all statuses
* @return returns key,value Map with multiple return values or null in case of exception
@@ -354,7 +354,7 @@ public class ScopeApplicationAdapter /*extends MultiThreadedApplicationAdapter i
}
*/
- /**
+ /*
* Logic must be before roomDisconnect cause otherwise you cannot throw a
* message to each one
*
@@ -403,7 +403,7 @@ public class ScopeApplicationAdapter /*extends MultiThreadedApplicationAdapter i
}
*/
- /**
+ /*
* Removes the Client from the List, stops recording, adds the Room-Leave
* event to running recordings, clear Polls and removes Client from any list
*
@@ -448,7 +448,7 @@ public class ScopeApplicationAdapter /*extends MultiThreadedApplicationAdapter i
}
*/
- /**
+ /*
* This method handles the Event after a stream has been added all connected
* Clients in the same room will get a notification
*
@@ -531,7 +531,7 @@ public class ScopeApplicationAdapter /*extends MultiThreadedApplicationAdapter i
}
*/
- /**
+ /*
* This method handles the Event after a stream has been removed all
* connected Clients in the same room will get a notification
*
@@ -645,6 +645,7 @@ public class ScopeApplicationAdapter /*extends MultiThreadedApplicationAdapter i
sendMessageToCurrentScope("sendVarsToMessage", newMessage, true);
return 1;
}
+ */
/**
* wrapper method
@@ -792,7 +793,7 @@ public class ScopeApplicationAdapter /*extends MultiThreadedApplicationAdapter i
}
*/
- /**
+ /*
* wrapper method
*
* @param newMessage - message being sent
@@ -838,7 +839,7 @@ public class ScopeApplicationAdapter /*extends MultiThreadedApplicationAdapter i
}
*/
- /**
+ /*
* Function is used to send the kick Trigger at the moment,
* it sends a general message to a specific clientId
*
@@ -864,7 +865,7 @@ public class ScopeApplicationAdapter /*extends MultiThreadedApplicationAdapter i
}
*/
- /**
+ /*
* Sends a message to a user in the same room by its clientId
*
* @param uid - uid of the recepient
@@ -957,6 +958,7 @@ public class ScopeApplicationAdapter /*extends MultiThreadedApplicationAdapter i
}
return ids;
}
+ */
/**
* Returns number of SIP conference participants
diff --git a/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/basic/ConfigurationDao.java b/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/basic/ConfigurationDao.java
index b3adf95..95a2753 100644
--- a/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/basic/ConfigurationDao.java
+++ b/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/basic/ConfigurationDao.java
@@ -25,14 +25,6 @@ import static org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_CRYPT;
import static org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_DEFAULT_LANG;
import static org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_DEFAULT_TIMEZONE;
import static org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_EXT_PROCESS_TTL;
-import static org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_FLASH_CAM_QUALITY;
-import static org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_FLASH_ECHO_PATH;
-import static org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_FLASH_MIC_RATE;
-import static org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_FLASH_SECURE;
-import static org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_FLASH_SECURE_PROXY;
-import static org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_FLASH_VIDEO_BANDWIDTH;
-import static org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_FLASH_VIDEO_CODEC;
-import static org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_FLASH_VIDEO_FPS;
import static org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_GOOGLE_ANALYTICS_CODE;
import static org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_HEADER_CSP;
import static org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_HEADER_XFRAME;
@@ -47,16 +39,6 @@ import static org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_SIP_ENAB
import static org.apache.openmeetings.util.OpenmeetingsVariables.DEFAULT_APP_NAME;
import static org.apache.openmeetings.util.OpenmeetingsVariables.DEFAULT_BASE_URL;
import static org.apache.openmeetings.util.OpenmeetingsVariables.DEFAULT_MAX_UPLOAD_SIZE;
-import static org.apache.openmeetings.util.OpenmeetingsVariables.FLASH_BANDWIDTH;
-import static org.apache.openmeetings.util.OpenmeetingsVariables.FLASH_ECHO_PATH;
-import static org.apache.openmeetings.util.OpenmeetingsVariables.FLASH_FPS;
-import static org.apache.openmeetings.util.OpenmeetingsVariables.FLASH_MIC_RATE;
-import static org.apache.openmeetings.util.OpenmeetingsVariables.FLASH_NATIVE_SSL;
-import static org.apache.openmeetings.util.OpenmeetingsVariables.FLASH_PORT;
-import static org.apache.openmeetings.util.OpenmeetingsVariables.FLASH_QUALITY;
-import static org.apache.openmeetings.util.OpenmeetingsVariables.FLASH_SECURE;
-import static org.apache.openmeetings.util.OpenmeetingsVariables.FLASH_SSL_PORT;
-import static org.apache.openmeetings.util.OpenmeetingsVariables.FLASH_VIDEO_CODEC;
import static org.apache.openmeetings.util.OpenmeetingsVariables.getRoomSettings;
import static org.apache.openmeetings.util.OpenmeetingsVariables.getWicketApplicationName;
import static org.apache.openmeetings.util.OpenmeetingsVariables.setApplicationName;
@@ -72,15 +54,11 @@ import static org.apache.openmeetings.util.OpenmeetingsVariables.setRestAllowOri
import static org.apache.openmeetings.util.OpenmeetingsVariables.setRoomSettings;
import static org.apache.openmeetings.util.OpenmeetingsVariables.setSipEnabled;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStream;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
-import java.util.Properties;
import java.util.TimeZone;
import javax.persistence.EntityManager;
@@ -97,7 +75,6 @@ import org.apache.openmeetings.db.dao.IDataProviderDao;
import org.apache.openmeetings.db.dao.user.UserDao;
import org.apache.openmeetings.db.entity.basic.Configuration;
import org.apache.openmeetings.util.DaoHelper;
-import org.apache.openmeetings.util.OmFileHelper;
import org.apache.openmeetings.util.OpenmeetingsVariables;
import org.apache.openmeetings.util.crypt.CryptProvider;
import org.apache.wicket.Application;
@@ -288,14 +265,9 @@ public class ConfigurationDao implements IDataProviderDao<Configuration> {
entity = em.merge(entity);
}
switch (key) {
- case CONFIG_FLASH_SECURE:
- case CONFIG_FLASH_SECURE_PROXY:
- case CONFIG_FLASH_VIDEO_CODEC:
- case CONFIG_FLASH_VIDEO_FPS:
- case CONFIG_FLASH_VIDEO_BANDWIDTH:
- case CONFIG_FLASH_CAM_QUALITY:
- case CONFIG_FLASH_ECHO_PATH:
- case CONFIG_FLASH_MIC_RATE:
+ case CONFIG_KEYCODE_ARRANGE:
+ case CONFIG_KEYCODE_EXCLUSIVE:
+ case CONFIG_KEYCODE_MUTE:
reloadRoomSettings();
break;
case CONFIG_MAX_UPLOAD_SIZE:
@@ -438,21 +410,7 @@ public class ConfigurationDao implements IDataProviderDao<Configuration> {
private JSONObject reloadRoomSettings() {
try {
- Properties props = new Properties();
- try (InputStream is = new FileInputStream(new File(new File(OmFileHelper.getRootDir(), "conf"), "red5.properties"))) {
- props.load(is);
- }
setRoomSettings(new JSONObject()
- .put(FLASH_SECURE, getBool(CONFIG_FLASH_SECURE, false))
- .put(FLASH_NATIVE_SSL, "best".equals(getString(CONFIG_FLASH_SECURE_PROXY, "none")))
- .put(FLASH_PORT, props.getProperty("rtmp.port"))
- .put(FLASH_SSL_PORT, props.getProperty("rtmps.port"))
- .put(FLASH_VIDEO_CODEC, getString(CONFIG_FLASH_VIDEO_CODEC, "h263"))
- .put(FLASH_FPS, getLong(CONFIG_FLASH_VIDEO_FPS, 30L))
- .put(FLASH_BANDWIDTH, getLong(CONFIG_FLASH_VIDEO_BANDWIDTH, 0L))
- .put(FLASH_QUALITY, getLong(CONFIG_FLASH_CAM_QUALITY, 90L))
- .put(FLASH_ECHO_PATH, getLong(CONFIG_FLASH_ECHO_PATH, 128L))
- .put(FLASH_MIC_RATE, getLong(CONFIG_FLASH_MIC_RATE, 22L))
.put("keycode", new JSONObject()
.put("arrange", getLong(CONFIG_KEYCODE_ARRANGE, 119L))
.put("exclusive", getLong(CONFIG_KEYCODE_EXCLUSIVE, 123L))
diff --git a/openmeetings-server/src/site/xdoc/BuildInstructions.xml b/openmeetings-server/src/site/xdoc/BuildInstructions.xml
index e27fb4b..1dabb92 100644
--- a/openmeetings-server/src/site/xdoc/BuildInstructions.xml
+++ b/openmeetings-server/src/site/xdoc/BuildInstructions.xml
@@ -58,6 +58,7 @@
<source>mvn org.apache.maven.plugins:maven-dependency-plugin:3.0.0:analyze-only</source>
</section>
<section name="Tips and Gotchas">
+ <p>Eclipse ANSI colors plugin for colors in console</p>
<source><![CDATA[
MAVEN_OPTS='-Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n' mvn clean -P allModules,quick,mysql,jetty jetty:run-exploded
diff --git a/openmeetings-util/pom.xml b/openmeetings-util/pom.xml
index e8d7a96..93fe9a9 100644
--- a/openmeetings-util/pom.xml
+++ b/openmeetings-util/pom.xml
@@ -136,5 +136,10 @@
<artifactId>tika-parsers</artifactId>
<version>1.17</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.pdfbox</groupId>
+ <artifactId>jbig2-imageio</artifactId>
+ <version>3.0.0</version>
+ </dependency>
</dependencies>
</project>
diff --git a/openmeetings-web/pom.xml b/openmeetings-web/pom.xml
index 6d9b99b..c51d872 100644
--- a/openmeetings-web/pom.xml
+++ b/openmeetings-web/pom.xml
@@ -464,6 +464,7 @@
<red5.root>red5.root</red5.root>
<backups.dir>${old-backups.dir}</backups.dir>
<catalina.useNaming>true</catalina.useNaming>
+ <current_openmeetings_log_dir>${project.build.directory}</current_openmeetings_log_dir>
</systemPropertyVariables>
<skip>${maven.test.skip}</skip>
</configuration>
@@ -642,24 +643,11 @@
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox</artifactId>
<version>${pdfbox.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.apache.pdfbox</groupId>
- <artifactId>pdfbox-tools</artifactId>
- </exclusion>
- </exclusions>
</dependency>
- <!-- JETTY DEPENDENCIES FOR TESTING -->
<dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-webapp</artifactId>
- <scope>test</scope>
- <version>${jetty9.version}</version>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-jmx</artifactId>
- <version>${jetty9.version}</version>
+ <groupId>org.apache.tomcat.embed</groupId>
+ <artifactId>tomcat-embed-websocket</artifactId>
+ <version>${tomcat.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
diff --git a/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/Application.java b/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/Application.java
index 8881f12..cf51be5 100644
--- a/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/Application.java
+++ b/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/Application.java
@@ -276,10 +276,12 @@ public class Application extends AuthenticatedWebApplication implements IApplica
log.debug("InitComponent::PostConstruct");
try {
- OmFileHelper.setOmHome(new File(getServletContext().getRealPath("/"))); //FIXME TODO move to OMContextListener
- LabelDao.initLanguageMap(); //FIXME TODO move to OMContextListener
+ if (OmFileHelper.getOmHome() == null) {
+ OmFileHelper.setOmHome(new File(getServletContext().getRealPath("/")));
+ }
+ LabelDao.initLanguageMap();
- log.debug("webAppPath : {}", OmFileHelper.getOmHome()); //FIXME TODO move to OMContextListener
+ log.debug("webAppPath : {}", OmFileHelper.getOmHome());
// Init all global config properties
cfgDao.reinit();
diff --git a/openmeetings-web/src/main/webapp/WEB-INF/applicationContext.xml b/openmeetings-web/src/main/webapp/WEB-INF/classes/applicationContext.xml
similarity index 100%
rename from openmeetings-web/src/main/webapp/WEB-INF/applicationContext.xml
rename to openmeetings-web/src/main/webapp/WEB-INF/classes/applicationContext.xml
diff --git a/openmeetings-web/src/main/webapp/WEB-INF/classes/logback-config.xml b/openmeetings-web/src/main/webapp/WEB-INF/classes/logback-config.xml
index ea11795..17a0a42 100644
--- a/openmeetings-web/src/main/webapp/WEB-INF/classes/logback-config.xml
+++ b/openmeetings-web/src/main/webapp/WEB-INF/classes/logback-config.xml
@@ -24,31 +24,24 @@
<jmxConfigurator contextName="${current_openmeetings_context_name}" />
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
- <File>${current_openmeetings_log_dir}/${current_openmeetings_context_name}.log</File>
- <Append>false</Append>
- <Encoding>UTF-8</Encoding>
- <BufferedIO>false</BufferedIO>
- <ImmediateFlush>true</ImmediateFlush>
- <layout class="ch.qos.logback.classic.PatternLayout">
- <Pattern>
- %5p %d{MM-dd HH:mm:ss.SSS } %c{15}:%L [%.15thread] - %m%n
- </Pattern>
- </layout>
- <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
- <!-- daily rollover -->
+ <file>${current_openmeetings_log_dir}/${current_openmeetings_context_name}.log</file>
+ <append>false</append>
+ <immediateFlush>true</immediateFlush>
+ <encoder>
+ <charset>UTF-8</charset>
+ <pattern>%5p %d{MM-dd HH:mm:ss.SSS } %c{15}:%L [%.15thread] - %m%n</pattern>
+ </encoder>
+ <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${current_openmeetings_log_dir}/${current_openmeetings_context_name}.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
- <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
- <!-- or whenever the file size reaches 100MB -->
- <maxFileSize>50MB</maxFileSize>
- </timeBasedFileNamingAndTriggeringPolicy>
- <!-- keep 30 days' worth of history -->
+ <maxFileSize>50MB</maxFileSize>
<maxHistory>50</maxHistory>
</rollingPolicy>
</appender>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
- <layout class="ch.qos.logback.classic.PatternLayout">
+ <encoder>
+ <charset>UTF-8</charset>
<pattern>%highlight(%-5level) %d{MM-dd HH:mm:ss.SSS } %cyan(%c{15}:%L [%.15thread]) - %m%n</pattern>
- </layout>
+ </encoder>
</appender>
<logger name="com.mchange.v2" level="ERROR" />
<logger name="org.apache.axiom" level="ERROR" />
diff --git a/openmeetings-web/src/main/webapp/WEB-INF/web.xml b/openmeetings-web/src/main/webapp/WEB-INF/web.xml
index 70036be..93f9a2a 100644
--- a/openmeetings-web/src/main/webapp/WEB-INF/web.xml
+++ b/openmeetings-web/src/main/webapp/WEB-INF/web.xml
@@ -21,6 +21,10 @@
<web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">
+ <context-param>
+ <param-name>contextConfigLocation</param-name>
+ <param-value>/WEB-INF/classes/applicationContext.xml</param-value>
+ </context-param>
<listener>
<listener-class>org.apache.openmeetings.util.OMContextListener</listener-class>
</listener>
diff --git a/openmeetings-web/src/test/java/org/apache/openmeetings/webservice/AbstractWebServiceTest.java b/openmeetings-web/src/test/java/org/apache/openmeetings/webservice/AbstractWebServiceTest.java
index e2ed6cb..6490105 100644
--- a/openmeetings-web/src/test/java/org/apache/openmeetings/webservice/AbstractWebServiceTest.java
+++ b/openmeetings-web/src/test/java/org/apache/openmeetings/webservice/AbstractWebServiceTest.java
@@ -20,6 +20,7 @@ package org.apache.openmeetings.webservice;
import static javax.ws.rs.core.MediaType.APPLICATION_FORM_URLENCODED;
import static org.apache.openmeetings.AbstractWicketTester.getWicketTester;
+import static org.apache.openmeetings.util.OmFileHelper.getOmHome;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -27,16 +28,19 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.lang.management.ManagementFactory;
+import java.net.InetAddress;
+import java.nio.file.Files;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
-import javax.management.MBeanServer;
import javax.ws.rs.core.Form;
import javax.ws.rs.core.MediaType;
+import org.apache.catalina.LifecycleState;
+import org.apache.catalina.connector.Connector;
+import org.apache.catalina.startup.Tomcat;
import org.apache.cxf.jaxrs.client.WebClient;
import org.apache.cxf.jaxrs.ext.multipart.Attachment;
import org.apache.cxf.transports.http.configuration.HTTPClientPolicy;
@@ -51,20 +55,13 @@ import org.apache.openmeetings.db.entity.user.User;
import org.apache.openmeetings.web.app.WebSession;
import org.apache.openmeetings.webservice.util.AppointmentMessageBodyReader;
import org.apache.wicket.util.tester.WicketTester;
-import org.eclipse.jetty.jmx.MBeanContainer;
-import org.eclipse.jetty.server.HttpConfiguration;
-import org.eclipse.jetty.server.HttpConnectionFactory;
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.server.ServerConnector;
-import org.eclipse.jetty.util.component.AbstractLifeCycle;
-import org.eclipse.jetty.webapp.WebAppContext;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
public class AbstractWebServiceTest extends AbstractJUnitDefaults {
- private static Server server;
+ private static Tomcat tomcat;
private static final String HOST = "localhost";
private static final String CONTEXT = "/openmeetings";
private static int port = 8080;
@@ -102,27 +99,21 @@ public class AbstractWebServiceTest extends AbstractJUnitDefaults {
@BeforeClass
public static void initialize() throws Exception {
- server = new Server();
- HttpConfiguration config = new HttpConfiguration();
- ServerConnector http = new ServerConnector(server, new HttpConnectionFactory(config));
- http.setPort(0);
- http.setIdleTimeout(1000 * 60 * 60);
- server.addConnector(http);
-
- WebAppContext bb = new WebAppContext();
- bb.setServer(server);
- bb.setContextPath("/");
- bb.setWar("src/main/webapp");
-
- server.setHandler(bb);
-
- MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
- MBeanContainer mBeanContainer = new MBeanContainer(mBeanServer);
- server.addEventListener(mBeanContainer);
- server.addBean(mBeanContainer);
- server.start();
- server.join();
- port = ((ServerConnector)server.getConnectors()[0]).getLocalPort();
+ tomcat = new Tomcat();
+ Connector connector = new Connector("HTTP/1.1");
+ connector.setAttribute("address", InetAddress.getByName(HOST).getHostAddress());
+ connector.setPort(0);
+ tomcat.getService().addConnector(connector);
+ tomcat.setConnector(connector);
+ File wd = Files.createTempDirectory("om" + UUID.randomUUID().toString()).toFile();
+ tomcat.setBaseDir(wd.getCanonicalPath());
+ tomcat.getHost().setAppBase(wd.getCanonicalPath());
+ tomcat.getHost().setAutoDeploy(false);
+ tomcat.getHost().setDeployOnStartup(false);
+ tomcat.addWebapp(CONTEXT, getOmHome().getAbsolutePath());
+ tomcat.getConnector(); // to init the connector
+ tomcat.start();
+ port = tomcat.getConnector().getLocalPort();
}
@Override
@@ -142,8 +133,11 @@ public class AbstractWebServiceTest extends AbstractJUnitDefaults {
@AfterClass
public static void destroy() throws Exception {
- if (server != null && (AbstractLifeCycle.STARTING.equals(server.getState()) || AbstractLifeCycle.STARTED.equals(server.getState()))) {
- server.stop();
+ if (tomcat.getServer() != null && tomcat.getServer().getState() != LifecycleState.DESTROYED) {
+ if (tomcat.getServer().getState() != LifecycleState.STOPPED) {
+ tomcat.stop();
+ }
+ tomcat.destroy();
}
}
diff --git a/openmeetings-web/src/test/resources/logback-test.xml b/openmeetings-web/src/test/resources/logback-test.xml
index 6463b06..17a0a42 100644
--- a/openmeetings-web/src/test/resources/logback-test.xml
+++ b/openmeetings-web/src/test/resources/logback-test.xml
@@ -24,31 +24,24 @@
<jmxConfigurator contextName="${current_openmeetings_context_name}" />
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
- <File>log/${current_openmeetings_context_name}.log</File>
- <Append>false</Append>
- <Encoding>UTF-8</Encoding>
- <BufferedIO>false</BufferedIO>
- <ImmediateFlush>true</ImmediateFlush>
- <layout class="ch.qos.logback.classic.PatternLayout">
- <Pattern>
- %5p %d{MM-dd HH:mm:ss.SSS } %c{15}:%L [%.15thread] - %m%n
- </Pattern>
- </layout>
- <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
- <!-- daily rollover -->
- <fileNamePattern>log\${current_openmeetings_context_name}.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
- <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
- <!-- or whenever the file size reaches 100MB -->
- <maxFileSize>50MB</maxFileSize>
- </timeBasedFileNamingAndTriggeringPolicy>
- <!-- keep 30 days' worth of history -->
+ <file>${current_openmeetings_log_dir}/${current_openmeetings_context_name}.log</file>
+ <append>false</append>
+ <immediateFlush>true</immediateFlush>
+ <encoder>
+ <charset>UTF-8</charset>
+ <pattern>%5p %d{MM-dd HH:mm:ss.SSS } %c{15}:%L [%.15thread] - %m%n</pattern>
+ </encoder>
+ <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+ <fileNamePattern>${current_openmeetings_log_dir}/${current_openmeetings_context_name}.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+ <maxFileSize>50MB</maxFileSize>
<maxHistory>50</maxHistory>
</rollingPolicy>
</appender>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
- <layout class="ch.qos.logback.classic.PatternLayout">
- <pattern>%5p %d{MM-dd HH:mm:ss.SSS } %r %L %c{15} [%.15thread] - %m%n</pattern>
- </layout>
+ <encoder>
+ <charset>UTF-8</charset>
+ <pattern>%highlight(%-5level) %d{MM-dd HH:mm:ss.SSS } %cyan(%c{15}:%L [%.15thread]) - %m%n</pattern>
+ </encoder>
</appender>
<logger name="com.mchange.v2" level="ERROR" />
<logger name="org.apache.axiom" level="ERROR" />
--
To stop receiving notification emails like this one, please contact
solomax@apache.org.