Author: sebawagner
Date: Sun Oct 13 00:40:45 2013
New Revision: 1531608
URL: http://svn.apache.org/r1531608
Log:
OPENMEETINGS-817 Add derbynet to dependencies, add and modify patcher target to
prepare copied red5 instance for Selenium testing
Added:
openmeetings/trunk/singlewebapp/src/test/java/org/apache/openmeetings/test/derby/
openmeetings/trunk/singlewebapp/src/test/java/org/apache/openmeetings/test/derby/PrepareSystemFiles.java
openmeetings/trunk/singlewebapp/src/test/java/org/apache/openmeetings/test/derby/StartDerbyNetworkService.java
Modified:
openmeetings/trunk/singlewebapp/build.xml
openmeetings/trunk/singlewebapp/ivy.xml
openmeetings/trunk/singlewebapp/src/install/java/org/apache/openmeetings/cli/ConnectionPropertiesPatcher.java
openmeetings/trunk/singlewebapp/src/install/java/org/apache/openmeetings/cli/DerbyPatcher.java
openmeetings/trunk/singlewebapp/src/util/java/org/apache/openmeetings/util/OmFileHelper.java
Modified: openmeetings/trunk/singlewebapp/build.xml
URL:
http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/build.xml?rev=1531608&r1=1531607&r2=1531608&view=diff
==============================================================================
--- openmeetings/trunk/singlewebapp/build.xml (original)
+++ openmeetings/trunk/singlewebapp/build.xml Sun Oct 13 00:40:45 2013
@@ -853,6 +853,13 @@
<sleep seconds="10" />
</target>
+ <target name="prepare-selenium-test-database" description="Prepare
selenium database script">
+ <java
classname="org.apache.openmeetings.test.derby.PrepareSystemFiles">
+ <arg value="${dist.dir}/testred5/webapps/openmeetings"/>
+ <classpath refid="junit.classpath" />
+ </java>
+ </target>
+
<target name="-prepare-selenium-copy-test-instance"
description="Prepare selenium tests by starting up an OpenMeetings instance">
<copy todir="${dist.dir}/testred5">
<fileset dir="${dist.dir}/red5">
Modified: openmeetings/trunk/singlewebapp/ivy.xml
URL:
http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/ivy.xml?rev=1531608&r1=1531607&r2=1531608&view=diff
==============================================================================
--- openmeetings/trunk/singlewebapp/ivy.xml (original)
+++ openmeetings/trunk/singlewebapp/ivy.xml Sun Oct 13 00:40:45 2013
@@ -176,6 +176,9 @@
<dependency org="org.apache.derby" name="derbyclient"
rev="10.10.1.1" conf="openmeetings->*" transitive="false">
<include type="jar" />
</dependency>
+ <dependency org="org.apache.derby" name="derbynet"
rev="10.10.1.1" conf="openmeetings->*" transitive="false">
+ <include type="jar" />
+ </dependency>
<dependency org="postgresql" name="postgresql"
rev="9.1-901.jdbc4" conf="openmeetings->*" transitive="false">
<include type="jar" />
</dependency>
Modified:
openmeetings/trunk/singlewebapp/src/install/java/org/apache/openmeetings/cli/ConnectionPropertiesPatcher.java
URL:
http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/install/java/org/apache/openmeetings/cli/ConnectionPropertiesPatcher.java?rev=1531608&r1=1531607&r2=1531608&view=diff
==============================================================================
---
openmeetings/trunk/singlewebapp/src/install/java/org/apache/openmeetings/cli/ConnectionPropertiesPatcher.java
(original)
+++
openmeetings/trunk/singlewebapp/src/install/java/org/apache/openmeetings/cli/ConnectionPropertiesPatcher.java
Sun Oct 13 00:40:45 2013
@@ -42,7 +42,7 @@ public abstract class ConnectionProperti
protected static final String URL_PREFIX = "Url=";
protected ConnectionProperties connectionProperties;
- static ConnectionPropertiesPatcher getPatcher(String _dbType,
ConnectionProperties connectionProperties) {
+ public static ConnectionPropertiesPatcher getPatcher(String _dbType,
ConnectionProperties connectionProperties) {
DbType dbType = DbType.valueOf(_dbType);
ConnectionPropertiesPatcher patcher = null;
switch (dbType) {
Modified:
openmeetings/trunk/singlewebapp/src/install/java/org/apache/openmeetings/cli/DerbyPatcher.java
URL:
http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/install/java/org/apache/openmeetings/cli/DerbyPatcher.java?rev=1531608&r1=1531607&r2=1531608&view=diff
==============================================================================
---
openmeetings/trunk/singlewebapp/src/install/java/org/apache/openmeetings/cli/DerbyPatcher.java
(original)
+++
openmeetings/trunk/singlewebapp/src/install/java/org/apache/openmeetings/cli/DerbyPatcher.java
Sun Oct 13 00:40:45 2013
@@ -23,6 +23,11 @@ public class DerbyPatcher extends Connec
protected String getUrl(String _url, String host, String _port, String
_db) {
String db = (_db == null) ? "openmeetings" : _db;
String suffix = _url.substring(_url.indexOf(';'));
+
+ if (host != null && _port != null) {
+ return "jdbc:derby" + "://" + host + ":" + _port + "/"
+ db + suffix;
+ }
+
return "jdbc:derby" + ":" + db + suffix;
}
}
Added:
openmeetings/trunk/singlewebapp/src/test/java/org/apache/openmeetings/test/derby/PrepareSystemFiles.java
URL:
http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/test/java/org/apache/openmeetings/test/derby/PrepareSystemFiles.java?rev=1531608&view=auto
==============================================================================
---
openmeetings/trunk/singlewebapp/src/test/java/org/apache/openmeetings/test/derby/PrepareSystemFiles.java
(added)
+++
openmeetings/trunk/singlewebapp/src/test/java/org/apache/openmeetings/test/derby/PrepareSystemFiles.java
Sun Oct 13 00:40:45 2013
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License") + you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.openmeetings.test.derby;
+
+import java.io.File;
+
+import org.apache.openmeetings.cli.ConnectionProperties;
+import org.apache.openmeetings.cli.ConnectionPropertiesPatcher;
+import org.apache.openmeetings.util.OmFileHelper;
+
+/**
+ * This file is called from command line to patch the derby configuration
+ * during the automated run of Selenium
+ *
+ * @author swagner
+ *
+ */
+public class PrepareSystemFiles {
+
+ public static void main(String... args) {
+ try {
+ OmFileHelper.setOmHome(args[0]);
+
+ ConnectionProperties connectionProperties = new
ConnectionProperties();
+
+ File conf = new File(OmFileHelper.getWebinfDir(),
"classes/META-INF/persistence.xml");
+
+ if (conf.exists()) {
+ conf.delete();
+ }
+
+ String dbType = "derby";
+ File srcConf = new File(OmFileHelper.getWebinfDir(),
"classes/META-INF/" + dbType + "_persistence.xml");
+ ConnectionPropertiesPatcher.getPatcher(dbType,
connectionProperties).patch(
+ srcConf
+ , conf
+ , "localhost"
+ , "1527"
+ , "OpenMeetingsSeleniumTest"
+ , "user"
+ , "secret"
+ );
+ } catch (Exception err) {
+ err.printStackTrace();
+ }
+ }
+
+}
Added:
openmeetings/trunk/singlewebapp/src/test/java/org/apache/openmeetings/test/derby/StartDerbyNetworkService.java
URL:
http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/test/java/org/apache/openmeetings/test/derby/StartDerbyNetworkService.java?rev=1531608&view=auto
==============================================================================
---
openmeetings/trunk/singlewebapp/src/test/java/org/apache/openmeetings/test/derby/StartDerbyNetworkService.java
(added)
+++
openmeetings/trunk/singlewebapp/src/test/java/org/apache/openmeetings/test/derby/StartDerbyNetworkService.java
Sun Oct 13 00:40:45 2013
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License") + you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.openmeetings.test.derby;
+
+import org.apache.derby.drda.NetworkServerControl;
+
+public class StartDerbyNetworkService {
+
+ protected NetworkServerControl server;
+}
Modified:
openmeetings/trunk/singlewebapp/src/util/java/org/apache/openmeetings/util/OmFileHelper.java
URL:
http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/util/java/org/apache/openmeetings/util/OmFileHelper.java?rev=1531608&r1=1531607&r2=1531608&view=diff
==============================================================================
---
openmeetings/trunk/singlewebapp/src/util/java/org/apache/openmeetings/util/OmFileHelper.java
(original)
+++
openmeetings/trunk/singlewebapp/src/util/java/org/apache/openmeetings/util/OmFileHelper.java
Sun Oct 13 00:40:45 2013
@@ -32,6 +32,9 @@ import org.slf4j.Logger;
public class OmFileHelper {
private static final Logger log =
Red5LoggerFactory.getLogger(OmFileHelper.class,
OpenmeetingsVariables.webAppRootKey);
+ /**
+ * This variable needs to point to the openmeetings webapp directory
+ */
private static File OM_HOME = null;
private static final String UPLOAD_DIR = "upload";
private static final String UPLOAD_TEMP_DIR = "uploadtemp";