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 2017/10/01 05:43:28 UTC

[4/4] openmeetings git commit: [OPENMEETINGS-1714] more issues are fixed

[OPENMEETINGS-1714] more issues are fixed


Project: http://git-wip-us.apache.org/repos/asf/openmeetings/repo
Commit: http://git-wip-us.apache.org/repos/asf/openmeetings/commit/3dac8e2f
Tree: http://git-wip-us.apache.org/repos/asf/openmeetings/tree/3dac8e2f
Diff: http://git-wip-us.apache.org/repos/asf/openmeetings/diff/3dac8e2f

Branch: refs/heads/master
Commit: 3dac8e2feb36c1384bfb72afaca6dfd41646f20a
Parents: c08491a
Author: Maxim Solodovnik <so...@gmail.com>
Authored: Sun Oct 1 12:43:14 2017 +0700
Committer: Maxim Solodovnik <so...@gmail.com>
Committed: Sun Oct 1 12:43:14 2017 +0700

----------------------------------------------------------------------
 .../util/crypt/AbstractCryptTest.java           |   7 +
 .../openmeetings/util/crypt/TestSCrypt.java     |   1 +
 .../openmeetings/AbstractJUnitDefaults.java     | 194 ++++++++++++
 .../apache/openmeetings/AbstractSpringTest.java |  55 ++++
 .../openmeetings/AbstractWicketTester.java      |  75 +++++
 .../openmeetings/backup/TestOldBackups.java     | 124 ++++++++
 .../calendar/TestAppointmentAddAppointment.java | 149 +++++++++
 .../calendar/TestAppointmentSchedulerTask.java  |  50 +++
 .../TestDatabaseStructureAppointment.java       |  76 +++++
 ...tDatabaseStructureGetAppointmentByRange.java | 105 +++++++
 .../TestDatabaseStructureGetUserStart.java      |  44 +++
 .../TestDatabaseStructureMeetingMember.java     |  41 +++
 .../TestDatabaseStructureUsersSearch.java       |  49 +++
 .../calendar/TestGetAppointment.java            |  60 ++++
 .../openmeetings/calendar/TestOmCalendar.java   |  58 ++++
 .../calendar/TestSendIcalMessage.java           | 235 ++++++++++++++
 .../apache/openmeetings/config/TestConfig.java  |  74 +++++
 .../core/file/TestFileProcessor.java            |  58 ++++
 .../openmeetings/derby/PrepareSystemFiles.java  |  67 ++++
 .../openmeetings/domain/TestAddGroup.java       |  60 ++++
 .../domain/TestUserGroupAggregation.java        |  51 +++
 .../invitiation/TestInvitation.java             |  57 ++++
 .../selenium/AbstractTestDefaults.java          | 229 ++++++++++++++
 .../openmeetings/selenium/HeavyTests.java       |  23 ++
 .../openmeetings/selenium/SeleniumTests.java    |  23 ++
 .../openmeetings/selenium/SeleniumUtils.java    | 229 ++++++++++++++
 .../openmeetings/selenium/TestSignUp.java       | 128 ++++++++
 .../openmeetings/smoke/TestSmokeBasic.java      |  36 +++
 .../test/AbstractJUnitDefaults.java             | 194 ------------
 .../openmeetings/test/AbstractSpringTest.java   |  55 ----
 .../openmeetings/test/AbstractWicketTester.java |  75 -----
 .../test/backup/TestOldBackups.java             | 124 --------
 .../calendar/TestAppointmentAddAppointment.java | 149 ---------
 .../calendar/TestAppointmentSchedulerTask.java  |  50 ---
 .../TestDatabaseStructureAppointment.java       |  76 -----
 ...tDatabaseStructureGetAppointmentByRange.java | 105 -------
 .../TestDatabaseStructureGetUserStart.java      |  44 ---
 .../TestDatabaseStructureMeetingMember.java     |  41 ---
 .../TestDatabaseStructureUsersSearch.java       |  49 ---
 .../test/calendar/TestGetAppointment.java       |  60 ----
 .../test/calendar/TestOmCalendar.java           |  58 ----
 .../test/calendar/TestSendIcalMessage.java      | 235 --------------
 .../openmeetings/test/config/TestConfig.java    |  74 -----
 .../test/core/file/TestFileProcessor.java       |  58 ----
 .../test/derby/PrepareSystemFiles.java          |  67 ----
 .../openmeetings/test/domain/TestAddGroup.java  |  60 ----
 .../test/domain/TestUserGroupAggregation.java   |  51 ---
 .../test/invitiation/TestInvitation.java        |  57 ----
 .../test/selenium/AbstractTestDefaults.java     | 229 --------------
 .../openmeetings/test/selenium/HeavyTests.java  |  23 --
 .../test/selenium/SeleniumTests.java            |  23 --
 .../test/selenium/SeleniumUtils.java            | 229 --------------
 .../openmeetings/test/selenium/TestSignUp.java  | 128 --------
 .../openmeetings/test/smoke/TestSmokeBasic.java |  36 ---
 .../openmeetings/test/user/TestUserContact.java | 105 -------
 .../openmeetings/test/user/TestUserCount.java   |  58 ----
 .../openmeetings/test/user/TestUserGroup.java   | 132 --------
 .../openmeetings/test/userdata/TestAuth.java    |  44 ---
 .../openmeetings/test/userdata/TestLogin.java   |  45 ---
 .../openmeetings/test/util/TestStoredFile.java  |  42 ---
 .../apache/openmeetings/test/web/LoginUI.java   |  77 -----
 .../test/webservice/AbstractWebServiceTest.java | 186 -----------
 .../test/webservice/TestCalendarService.java    | 308 -------------------
 .../test/webservice/TestFileService.java        |  73 -----
 .../test/webservice/TestGroupService.java       |  67 ----
 .../test/webservice/TestRecordingService.java   |  73 -----
 .../test/webservice/TestRoomService.java        | 169 ----------
 .../test/webservice/TestUserService.java        | 113 -------
 .../test/webservice/TestWebConverters.java      |  61 ----
 .../openmeetings/user/TestUserContact.java      | 105 +++++++
 .../apache/openmeetings/user/TestUserCount.java |  58 ++++
 .../apache/openmeetings/user/TestUserGroup.java | 132 ++++++++
 .../apache/openmeetings/userdata/TestAuth.java  |  44 +++
 .../apache/openmeetings/userdata/TestLogin.java |  45 +++
 .../openmeetings/util/TestStoredFile.java       |  42 +++
 .../org/apache/openmeetings/web/LoginUI.java    |  77 +++++
 .../web/app/TestOmAuthenticationStrategy.java   |  33 ++
 .../webservice/AbstractWebServiceTest.java      | 186 +++++++++++
 .../webservice/TestCalendarService.java         | 308 +++++++++++++++++++
 .../webservice/TestFileService.java             |  73 +++++
 .../webservice/TestGroupService.java            |  67 ++++
 .../webservice/TestRecordingService.java        |  73 +++++
 .../webservice/TestRoomService.java             | 169 ++++++++++
 .../webservice/TestUserService.java             | 113 +++++++
 .../webservice/TestWebConverters.java           |  61 ++++
 pom.xml                                         |   8 +-
 86 files changed, 3948 insertions(+), 3907 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/openmeetings/blob/3dac8e2f/openmeetings-util/src/test/java/org/apache/openmeetings/util/crypt/AbstractCryptTest.java
----------------------------------------------------------------------
diff --git a/openmeetings-util/src/test/java/org/apache/openmeetings/util/crypt/AbstractCryptTest.java b/openmeetings-util/src/test/java/org/apache/openmeetings/util/crypt/AbstractCryptTest.java
index c641db4..3b8ccf4 100644
--- a/openmeetings-util/src/test/java/org/apache/openmeetings/util/crypt/AbstractCryptTest.java
+++ b/openmeetings-util/src/test/java/org/apache/openmeetings/util/crypt/AbstractCryptTest.java
@@ -19,6 +19,7 @@
 package org.apache.openmeetings.util.crypt;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
@@ -39,6 +40,12 @@ public abstract class AbstractCryptTest {
 		assertEquals("Hash for null should be null", null, hash);
 
 		assertTrue("Hash for null should be null", crypt.verify(null, null));
+		assertFalse("Hash for null should be null", crypt.verify(null, "abc"));
+		assertFalse("Hash for null should NOT be null", crypt.verify("abc", null));
+
+		assertTrue("Hash for null should be null", crypt.fallback(null, null));
+		assertFalse("Hash for null should be null", crypt.fallback(null, "abc"));
+		assertFalse("Hash for null should NOT be null", crypt.fallback("abc", null));
 	}
 
 	private static List<String> get(int count) {

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/3dac8e2f/openmeetings-util/src/test/java/org/apache/openmeetings/util/crypt/TestSCrypt.java
----------------------------------------------------------------------
diff --git a/openmeetings-util/src/test/java/org/apache/openmeetings/util/crypt/TestSCrypt.java b/openmeetings-util/src/test/java/org/apache/openmeetings/util/crypt/TestSCrypt.java
index 094d0b5..724817f 100644
--- a/openmeetings-util/src/test/java/org/apache/openmeetings/util/crypt/TestSCrypt.java
+++ b/openmeetings-util/src/test/java/org/apache/openmeetings/util/crypt/TestSCrypt.java
@@ -40,5 +40,6 @@ public class TestSCrypt extends AbstractCryptTest {
 		assertFalse("SHA256 is not valid hash", crypt.verify(TEST_PASS, SHA_HASH));
 		assertTrue("MD5 is valid fallback", crypt.fallback(TEST_PASS, MD5_HASH));
 		assertTrue("SHA256 is valid fallback", crypt.fallback(TEST_PASS, SHA_HASH));
+		assertFalse("Fallback can return false", crypt.fallback(TEST_PASS, "abc"));
 	}
 }

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/3dac8e2f/openmeetings-web/src/test/java/org/apache/openmeetings/AbstractJUnitDefaults.java
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/test/java/org/apache/openmeetings/AbstractJUnitDefaults.java b/openmeetings-web/src/test/java/org/apache/openmeetings/AbstractJUnitDefaults.java
new file mode 100644
index 0000000..5aebd72
--- /dev/null
+++ b/openmeetings-web/src/test/java/org/apache/openmeetings/AbstractJUnitDefaults.java
@@ -0,0 +1,194 @@
+/*
+ * 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;
+
+import static org.apache.openmeetings.util.OpenmeetingsVariables.getConfigKeyCryptClassName;
+import static org.apache.openmeetings.util.OpenmeetingsVariables.setWicketApplicationName;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.Date;
+import java.util.UUID;
+
+import org.apache.openmeetings.db.dao.basic.ConfigurationDao;
+import org.apache.openmeetings.db.dao.calendar.AppointmentDao;
+import org.apache.openmeetings.db.dao.user.UserDao;
+import org.apache.openmeetings.db.entity.calendar.Appointment;
+import org.apache.openmeetings.db.entity.room.Room;
+import org.apache.openmeetings.db.entity.user.Address;
+import org.apache.openmeetings.db.entity.user.User;
+import org.apache.openmeetings.installation.ImportInitvalues;
+import org.apache.openmeetings.installation.InstallationConfig;
+import org.junit.Before;
+import org.red5.logging.Red5LoggerFactory;
+import org.slf4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public abstract class AbstractJUnitDefaults extends AbstractSpringTest {
+	private static final Logger log = Red5LoggerFactory.getLogger(AbstractJUnitDefaults.class);
+	public static final int ONE_HOUR = 60 * 60 * 1000;
+
+	protected static final String username = "admin";
+	protected static final String userpass = "12345";
+	private static final String group = "smoketest";
+	private static final String timeZone = "Europe/Berlin";
+	private static final String email = "junit@openmeetings.apache.org";
+
+	@Autowired
+	private AppointmentDao appointmentDao;
+	@Autowired
+	private UserDao userDao;
+	@Autowired
+	private ImportInitvalues importInitvalues;
+	@Autowired
+	protected ConfigurationDao cfgDao;
+
+	@Before
+	public void setUp() throws Exception {
+		setWicketApplicationName("openmeetings");
+		cfgDao.getCryptKey();
+		if (userDao.count() < 1) {
+			makeDefaultScheme();
+			log.info("Default scheme created successfully");
+		} else {
+			log.info("Default scheme already created");
+		}
+		if (getConfigKeyCryptClassName() == null) {
+			assertNotNull("Crypt class name should not be null", cfgDao.getCryptKey());
+		}
+	}
+
+	public Appointment getAppointment() {
+		Date start = new Date();
+		Date end = new Date();
+		end.setTime(start.getTime() + ONE_HOUR);
+		return getAppointment(start, end);
+	}
+
+	public Appointment getAppointment(Date start, Date end) {
+		return getAppointment(userDao.get(1L), start, end);
+	}
+
+	public Appointment getAppointment(User owner, Date start, Date end) {
+		return getAppointment(owner, null, start, end);
+	}
+
+	public Appointment getAppointment(User owner, Room r, Date start, Date end) {
+		assertNotNull("Can't access to appointment dao implimentation", appointmentDao);
+
+		// add new appointment
+		Appointment ap = new Appointment();
+
+		ap.setTitle("appointmentName");
+		ap.setLocation("appointmentLocation");
+
+		ap.setStart(start);
+		ap.setEnd(end);
+		ap.setDescription("appointmentDescription");
+		ap.setInserted(new Date());
+		ap.setDeleted(false);
+		ap.setIsDaily(false);
+		ap.setIsWeekly(false);
+		ap.setIsMonthly(false);
+		ap.setIsYearly(false);
+		ap.setPasswordProtected(false);
+
+		ap.setOwner(owner);
+		ap.setConnectedEvent(false);
+
+		if (ap.getReminder() == null) {
+			ap.setReminder(Appointment.Reminder.none);
+		}
+
+		if (r == null) {
+			r = new Room();
+			r.setType(Room.Type.conference);
+			r.setAppointment(true);
+		}
+		ap.setRoom(r);
+		return ap;
+	}
+
+	public Appointment createAppointment(Appointment ap) {
+		// add new appointment
+		ap = appointmentDao.update(ap, null, false);
+		assertNotNull("Cann't add appointment", ap.getId());
+		return ap;
+	}
+
+	public User getUser() throws Exception {
+		return getUser(UUID.randomUUID().toString());
+	}
+
+	protected String createPass() {
+		return "pass1_!@#$%_A";
+	}
+
+	public User getUser(String uuid) throws Exception {
+		User u = new User();
+		// add user
+		u.setFirstname("firstname" + uuid);
+		u.setLastname("lastname" + uuid);
+		u.setLogin("login" + uuid);
+		u.setAddress(new Address());
+		u.getAddress().setEmail(String.format("email%s@local", uuid));
+		u.setRights(UserDao.getDefaultRights());
+		u.setTimeZoneId("Asia/Bangkok");
+		u.updatePassword(cfgDao, createPass());
+		u.setLanguageId(1L);
+		return u;
+	}
+
+	public User createUser() throws Exception {
+		return createUser(UUID.randomUUID().toString());
+	}
+
+	public User createUser(String uuid) throws Exception {
+		return createUser(getUser(uuid));
+	}
+
+	public User createUser(User u) {
+		u = userDao.update(u, null);
+		assertNotNull("Can't add user", u);
+		return u;
+	}
+
+	private void makeDefaultScheme() throws Exception {
+		InstallationConfig cfg = new InstallationConfig();
+		cfg.setUsername(username);
+		cfg.setPassword(userpass);
+		cfg.setEmail(email);
+		cfg.setGroup(group);
+		cfg.setTimeZone(timeZone);
+		importInitvalues.loadAll(cfg, false);
+	}
+
+	public User getContact(String uuid, Long ownerId) {
+		return userDao.getContact("email" + uuid, "firstname" + uuid, "lastname" + uuid, ownerId);
+	}
+
+	public User createUserContact(Long ownerId) {
+		return createUserContact(getContact(UUID.randomUUID().toString(), ownerId), ownerId);
+	}
+
+	public User createUserContact(User user, Long ownerId) {
+		user = userDao.update(user, ownerId);
+		assertNotNull("Cann't add user", user);
+		return user;
+	}
+}

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/3dac8e2f/openmeetings-web/src/test/java/org/apache/openmeetings/AbstractSpringTest.java
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/test/java/org/apache/openmeetings/AbstractSpringTest.java b/openmeetings-web/src/test/java/org/apache/openmeetings/AbstractSpringTest.java
new file mode 100644
index 0000000..d3d974c
--- /dev/null
+++ b/openmeetings-web/src/test/java/org/apache/openmeetings/AbstractSpringTest.java
@@ -0,0 +1,55 @@
+/*
+ * 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;
+
+import static org.junit.Assert.fail;
+
+import org.apache.openmeetings.db.dao.label.LabelDao;
+import org.apache.openmeetings.util.OmFileHelper;
+import org.apache.tomcat.util.scan.Constants;
+import org.junit.BeforeClass;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.TestExecutionListeners;
+import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@TestExecutionListeners({})
+@ContextConfiguration(locations={"classpath:applicationContext.xml"}, inheritLocations = true)
+public abstract class AbstractSpringTest extends AbstractJUnit4SpringContextTests {
+
+	@BeforeClass
+	public static void init() {
+		setOmHome();
+		System.setProperty(Constants.SKIP_JARS_PROPERTY, "*");
+		LabelDao.initLanguageMap();
+		if (LabelDao.getLanguages().isEmpty()) {
+			fail("Failed to set languages");
+		}
+	}
+
+	protected static void setOmHome() {
+		String webappsDir = System.getProperty("om.home", ".");
+		OmFileHelper.setOmHome(webappsDir);
+		if (!OmFileHelper.getOmHome().exists() || !OmFileHelper.getOmHome().isDirectory()) {
+			fail("Invalid directory is specified as OM HOME: " + webappsDir);
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/3dac8e2f/openmeetings-web/src/test/java/org/apache/openmeetings/AbstractWicketTester.java
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/test/java/org/apache/openmeetings/AbstractWicketTester.java b/openmeetings-web/src/test/java/org/apache/openmeetings/AbstractWicketTester.java
new file mode 100644
index 0000000..ec4b817
--- /dev/null
+++ b/openmeetings-web/src/test/java/org/apache/openmeetings/AbstractWicketTester.java
@@ -0,0 +1,75 @@
+/*
+ * 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;
+
+import static org.apache.openmeetings.db.util.ApplicationHelper.getWicketTester;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.Serializable;
+import java.util.List;
+
+import org.apache.openmeetings.db.entity.user.User.Type;
+import org.apache.openmeetings.util.OmException;
+import org.apache.openmeetings.web.app.WebSession;
+import org.apache.wicket.util.lang.Args;
+import org.apache.wicket.util.tester.WicketTester;
+
+import com.googlecode.wicket.jquery.ui.widget.dialog.AbstractDialog;
+import com.googlecode.wicket.jquery.ui.widget.dialog.ButtonAjaxBehavior;
+
+public class AbstractWicketTester extends AbstractJUnitDefaults {
+	protected WicketTester tester;
+
+	@Override
+	public void setUp() throws Exception {
+		super.setUp();
+		tester = getWicketTester();
+		assertNotNull("Web session should not be null", WebSession.get());
+	}
+
+	public void login(String login, String password) {
+		WebSession s = WebSession.get();
+		try {
+			if (login != null && password != null) {
+				s.signIn(login, password, Type.user, null);
+			} else {
+				s.signIn(username, userpass, Type.user, null);
+			}
+		} catch (OmException e) {
+			fail(e.getMessage());
+		}
+		assertTrue("Web session is not signed in for user: " + (login != null ? login : username), s.isSignedIn());
+	}
+
+	public <T extends Serializable> ButtonAjaxBehavior getButtonBehavior(String path, String name) {
+		Args.notNull(path, "path");
+		Args.notNull(name, "name");
+		@SuppressWarnings("unchecked")
+		AbstractDialog<T> dialog = (AbstractDialog<T>)tester.getComponentFromLastRenderedPage(path);
+		List<ButtonAjaxBehavior> bl = dialog.getBehaviors(ButtonAjaxBehavior.class);
+		for (ButtonAjaxBehavior bb : bl) {
+			if (name.equals(bb.getButton().getName())) {
+				return bb;
+			}
+		}
+		return null;
+	}
+}

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/3dac8e2f/openmeetings-web/src/test/java/org/apache/openmeetings/backup/TestOldBackups.java
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/test/java/org/apache/openmeetings/backup/TestOldBackups.java b/openmeetings-web/src/test/java/org/apache/openmeetings/backup/TestOldBackups.java
new file mode 100644
index 0000000..45509b3
--- /dev/null
+++ b/openmeetings-web/src/test/java/org/apache/openmeetings/backup/TestOldBackups.java
@@ -0,0 +1,124 @@
+/*
+ * 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.backup;
+
+import static org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_CRYPT;
+import static org.apache.openmeetings.util.OpenmeetingsVariables.getWebAppRootKey;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+
+import org.apache.openmeetings.AbstractJUnitDefaults;
+import org.apache.openmeetings.backup.BackupImport;
+import org.apache.openmeetings.db.dao.calendar.AppointmentDao;
+import org.apache.openmeetings.db.dao.calendar.MeetingMemberDao;
+import org.apache.openmeetings.db.dao.room.RoomDao;
+import org.apache.openmeetings.db.dao.room.RoomGroupDao;
+import org.apache.openmeetings.db.dao.user.GroupDao;
+import org.apache.openmeetings.db.dao.user.UserDao;
+import org.apache.openmeetings.db.entity.basic.Configuration;
+import org.junit.After;
+import org.junit.Test;
+import org.red5.logging.Red5LoggerFactory;
+import org.slf4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class TestOldBackups extends AbstractJUnitDefaults {
+	private static final Logger log = Red5LoggerFactory.getLogger(TestOldBackups.class, getWebAppRootKey());
+
+	@Autowired
+	private BackupImport backupController;
+	@Autowired
+	private GroupDao groupDao;
+	@Autowired
+	private UserDao userDao;
+	@Autowired
+	private RoomDao roomDao;
+	@Autowired
+	private AppointmentDao appointmentDao;
+	@Autowired
+	private MeetingMemberDao meetingMemberDao;
+	@Autowired
+	private RoomGroupDao roomGroupDao;
+	private String cryptClass = null;
+
+	@Override
+	public void setUp() throws Exception {
+		super.setUp();
+		// Crypt class need to be preserved here to avoid overriding by backup import
+		cryptClass = cfgDao.getCryptKey();
+	}
+
+	@After
+	public void tearDown() {
+		Configuration cfg = cfgDao.get(CONFIG_CRYPT);
+		assertNotNull("Not null config should be returned", cfg);
+		cfg.setValue(cryptClass);
+		cfgDao.update(cfg, null);
+	}
+
+	@Test
+	public void importOldVersions() {
+		String backupsDir = System.getProperty("backups.dir", ".");
+		File backupsHome = new File(backupsDir);
+
+		if (!backupsHome.exists() || !backupsHome.isDirectory()) {
+			fail("Invalid directory is specified for backup files: " + backupsDir);
+		}
+		long groupCount = 0;
+		long userCount = 0;
+		long roomCount = 0;
+		long roomGroupCount = 0;
+		long apptCount = 0;
+		long meetingMembersCount = 0;
+		for (File backup : backupsHome.listFiles()) {
+			String name = backup.getName();
+			log.debug("Import of backup file : '" + name + "' is started ...");
+			try (InputStream is = new FileInputStream(backup)) {
+				backupController.performImport(is);
+				long newGroupCount = groupDao.count();
+				long newUserCount = userDao.count();
+				long newRoomCount = roomDao.count();
+				long newRoomGroupCount = roomGroupDao.get().size();
+				long newApptCount = appointmentDao.get().size();
+				long newMeetingMembersCount = meetingMemberDao.getMeetingMembers().size();
+				assertTrue("Zero groups were imported from " + name, newGroupCount > groupCount);
+				assertTrue("Zero users were imported from " + name, newUserCount > userCount);
+				assertTrue("Zero rooms were imported from " + name, newRoomCount > roomCount);
+				assertTrue("Zero room groups were imported from " + name, newRoomGroupCount > roomGroupCount);
+				assertTrue("Zero appointments were imported from " + name, newApptCount > apptCount);
+				assertTrue("Zero meeting members were imported from " + name, newMeetingMembersCount > meetingMembersCount);
+
+				groupCount = newGroupCount;
+				userCount = newUserCount;
+				roomCount = newRoomCount;
+				roomGroupCount = newRoomGroupCount;
+				apptCount = newApptCount;
+				meetingMembersCount = newMeetingMembersCount;
+			} catch (Exception e) {
+				throw new RuntimeException("Unexpected exception while importing backup: " + name, e);
+			}
+			log.debug("... Done.");
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/3dac8e2f/openmeetings-web/src/test/java/org/apache/openmeetings/calendar/TestAppointmentAddAppointment.java
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/test/java/org/apache/openmeetings/calendar/TestAppointmentAddAppointment.java b/openmeetings-web/src/test/java/org/apache/openmeetings/calendar/TestAppointmentAddAppointment.java
new file mode 100644
index 0000000..6339b9c
--- /dev/null
+++ b/openmeetings-web/src/test/java/org/apache/openmeetings/calendar/TestAppointmentAddAppointment.java
@@ -0,0 +1,149 @@
+/*
+ * 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.calendar;
+
+import static org.apache.openmeetings.util.OpenmeetingsVariables.getWebAppRootKey;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.time.LocalDateTime;
+import java.time.ZoneId;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.UUID;
+
+import org.apache.openmeetings.AbstractWicketTester;
+import org.apache.openmeetings.db.dao.calendar.AppointmentDao;
+import org.apache.openmeetings.db.dao.user.UserDao;
+import org.apache.openmeetings.db.entity.calendar.Appointment;
+import org.apache.openmeetings.db.entity.calendar.Appointment.Reminder;
+import org.apache.openmeetings.db.entity.calendar.MeetingMember;
+import org.apache.openmeetings.db.entity.room.Room;
+import org.apache.openmeetings.db.entity.user.User;
+import org.apache.openmeetings.service.calendar.AppointmentLogic;
+import org.apache.openmeetings.web.app.WebSession;
+import org.apache.wicket.util.string.StringValue;
+import org.junit.Test;
+import org.red5.logging.Red5LoggerFactory;
+import org.slf4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class TestAppointmentAddAppointment extends AbstractWicketTester {
+	private static final Logger log = Red5LoggerFactory.getLogger(TestAppointmentAddAppointment.class, getWebAppRootKey());
+
+	@Autowired
+	private AppointmentLogic appointmentLogic;
+	@Autowired
+	private AppointmentDao appointmentDao;
+	@Autowired
+	private UserDao userDao;
+
+	private static void setTime(Appointment a) {
+		a.setStart(Date.from(LocalDateTime.now().atZone(ZoneId.systemDefault()).toInstant()));
+		a.setEnd(Date.from(LocalDateTime.now().plusHours(1).atZone(ZoneId.systemDefault()).toInstant()));
+	}
+
+	@Test
+	public void saveAppointment() throws Exception {
+		log.debug("- saveAppointment");
+
+		Calendar start = Calendar.getInstance();
+		start.setTimeInMillis(start.getTimeInMillis() + 600000);
+
+		Calendar end = Calendar.getInstance();
+		end.setTimeInMillis(start.getTimeInMillis() + 600000);
+
+		String appointmentName = "Test 01";
+		String appointmentDescription = "Descr";
+		Long userId = 1L;
+		String appointmentLocation = "office";
+		Boolean isMonthly = false;
+		Boolean isDaily = false;
+		Boolean isWeekly = false;
+		String remind = Appointment.Reminder.ical.name();
+		Boolean isYearly = false;
+		String[] mmClient = new String[1];
+		for (int i = 0; i < 1; i++) {
+			mmClient[0] = createClientObj("firstname" + i, "lastname" + i,
+					"first" + i + ".last" + i + "@webbase-design.de", "Etc/GMT+1");
+		}
+		Long languageId = 1L;
+		Long roomType = 1L;
+
+		Appointment a = appointmentLogic.getAppointment(appointmentName,
+				appointmentLocation, appointmentDescription,
+				start, end, isDaily, isWeekly,
+				isMonthly, isYearly, remind, mmClient,
+				roomType, languageId, false, "", -1, userId);
+		a = appointmentDao.update(a, userId);
+
+		Thread.sleep(3000);
+
+		appointmentLogic.doScheduledMeetingReminder();
+
+		Thread.sleep(3000);
+
+		assertNotNull("Saved appointment should have valid id: " + a.getId(), a.getId());
+	}
+
+	@Test
+	public void testCreate() {
+		Appointment a = new Appointment();
+		a.setTitle("Test title");
+		setTime(a);
+		a.setReminder(Reminder.ical);
+		a.setMeetingMembers(new ArrayList<>());
+		User owner = userDao.get(1L);
+		a.setOwner(owner);
+		a.setRoom(new Room());
+		a.getRoom().setAppointment(true);
+		a.getRoom().setType(Room.Type.conference);
+		for (int i = 0; i < 3; ++i) {
+			MeetingMember mm = new MeetingMember();
+			mm.setUser(getContact(UUID.randomUUID().toString(), owner.getId()));
+			a.getMeetingMembers().add(mm);
+		}
+		a = appointmentDao.update(a, owner.getId());
+		assertNotNull("Saved appointment should have valid id: " + a.getId(), a.getId());
+		assertEquals("Saved appointment should have corect count of guests: ", 3, a.getMeetingMembers().size());
+		for (MeetingMember mm : a.getMeetingMembers()) {
+			assertNotNull("Saved guest should have valid id: ", mm.getId());
+			assertNotNull("Saved guest should have valid invitation: ", mm.getInvitation());
+			assertNotNull("Saved guest should have invitation with ID: ", mm.getInvitation().getId());
+		}
+
+		WebSession ws = WebSession.get();
+		Appointment a1 = appointmentDao.get(a.getId());
+		ws.checkHashes(StringValue.valueOf(""), StringValue.valueOf(a1.getMeetingMembers().get(0).getInvitation().getHash()));
+		assertTrue("Login via secure hash should be successful", ws.isSignedIn());
+	}
+
+	private static String createClientObj(String firstname, String lastname, String email, String jNameTimeZone) {
+		StringBuilder sb = new StringBuilder();
+		sb.append(",") //memberId
+			.append(firstname).append(",")
+			.append(lastname).append(",")
+			.append(email).append(",")
+			.append(",") //userId
+			.append(jNameTimeZone);
+		return sb.toString();
+	}
+}

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/3dac8e2f/openmeetings-web/src/test/java/org/apache/openmeetings/calendar/TestAppointmentSchedulerTask.java
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/test/java/org/apache/openmeetings/calendar/TestAppointmentSchedulerTask.java b/openmeetings-web/src/test/java/org/apache/openmeetings/calendar/TestAppointmentSchedulerTask.java
new file mode 100644
index 0000000..b28d254
--- /dev/null
+++ b/openmeetings-web/src/test/java/org/apache/openmeetings/calendar/TestAppointmentSchedulerTask.java
@@ -0,0 +1,50 @@
+/*
+ * 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.calendar;
+
+import static org.apache.openmeetings.util.OpenmeetingsVariables.getWebAppRootKey;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.openmeetings.AbstractJUnitDefaults;
+import org.apache.openmeetings.service.calendar.AppointmentLogic;
+import org.junit.Test;
+import org.red5.logging.Red5LoggerFactory;
+import org.slf4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class TestAppointmentSchedulerTask extends AbstractJUnitDefaults {
+	private static final Logger log = Red5LoggerFactory.getLogger(TestAppointmentSchedulerTask.class, getWebAppRootKey());
+
+	@Autowired
+	private AppointmentLogic appointmentLogic;
+
+	@Test
+	public void doIt() {
+		log.debug("- 1 MeetingReminderJob.execute");
+		log.warn("- 2 MeetingReminderJob.execute");
+		try {
+			appointmentLogic.doScheduledMeetingReminder();
+
+			assertTrue(true);
+		} catch (Exception err){
+			log.error("execute",err);
+		}
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/3dac8e2f/openmeetings-web/src/test/java/org/apache/openmeetings/calendar/TestDatabaseStructureAppointment.java
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/test/java/org/apache/openmeetings/calendar/TestDatabaseStructureAppointment.java b/openmeetings-web/src/test/java/org/apache/openmeetings/calendar/TestDatabaseStructureAppointment.java
new file mode 100644
index 0000000..3cb9daf
--- /dev/null
+++ b/openmeetings-web/src/test/java/org/apache/openmeetings/calendar/TestDatabaseStructureAppointment.java
@@ -0,0 +1,76 @@
+/*
+ * 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.calendar;
+
+import static org.apache.openmeetings.util.OpenmeetingsVariables.getWebAppRootKey;
+
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.openmeetings.AbstractJUnitDefaults;
+import org.apache.openmeetings.db.dao.calendar.AppointmentDao;
+import org.apache.openmeetings.db.entity.calendar.Appointment;
+import org.junit.Test;
+import org.red5.logging.Red5LoggerFactory;
+import org.slf4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class TestDatabaseStructureAppointment extends AbstractJUnitDefaults {
+	private static final Logger log = Red5LoggerFactory.getLogger(TestDatabaseStructureAppointment.class, getWebAppRootKey());
+
+	@Autowired
+	private AppointmentDao appointmentDao;
+
+	@Test
+	public void testAddingGroup() {
+		try {
+			Calendar cal = Calendar.getInstance();
+			cal.set(2008, 9, 2);
+			cal.get(Calendar.DAY_OF_MONTH);
+			cal.getTime();
+
+			SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+			Date date = format.parse("2008-17-08");
+			Date date2 = format.parse("2008-18-08");
+
+			List<Appointment> listAppoints = appointmentDao.getInRange(1L, date, date2);
+			// List<Appointment> listAppoints = appointmentDao.searchAppointmentsByName("%");
+			// appointmentDao.getNextAppointmentById(1L);
+			// appointmentDao.addAppointment("mezo", 1L, "Pforzheim", "zweiter", Calendar.getInstance().getTime(),
+			// 		date, null, true, null, null, 1L,1L);
+			// appointmentDao.addAppointment("testap", "erster Test",Calendar.getInstance().getTime(),
+			// 		Calendar.getInstance().getTime(), true, false, false, false, new Long(1), 1L);
+			log.debug("Anzahl: " + listAppoints.size());
+
+			for (Appointment appoints : listAppoints) {
+				log.debug("Termin: " + appoints.getTitle() + " startDate: " + appoints.getStart() + " endDate: " + appoints.getEnd());
+				log.debug("MeetingMembers: " + appoints.getMeetingMembers().size());
+			}
+
+			for (Iterator<Appointment> iter = listAppoints.iterator(); iter.hasNext();) {
+				log.debug("" + iter.next());
+			}
+		} catch (Exception err) {
+			log.error("[testAddingGroup]", err);
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/3dac8e2f/openmeetings-web/src/test/java/org/apache/openmeetings/calendar/TestDatabaseStructureGetAppointmentByRange.java
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/test/java/org/apache/openmeetings/calendar/TestDatabaseStructureGetAppointmentByRange.java b/openmeetings-web/src/test/java/org/apache/openmeetings/calendar/TestDatabaseStructureGetAppointmentByRange.java
new file mode 100644
index 0000000..ceacb41
--- /dev/null
+++ b/openmeetings-web/src/test/java/org/apache/openmeetings/calendar/TestDatabaseStructureGetAppointmentByRange.java
@@ -0,0 +1,105 @@
+/*
+ * 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.calendar;
+
+import static org.apache.openmeetings.util.OpenmeetingsVariables.getWebAppRootKey;
+import static org.junit.Assert.assertEquals;
+
+import java.util.ArrayList;
+import java.util.Calendar;
+
+import org.apache.openmeetings.AbstractJUnitDefaults;
+import org.apache.openmeetings.db.dao.calendar.AppointmentDao;
+import org.apache.openmeetings.db.entity.calendar.Appointment;
+import org.apache.openmeetings.db.entity.calendar.MeetingMember;
+import org.junit.Test;
+import org.red5.logging.Red5LoggerFactory;
+import org.slf4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class TestDatabaseStructureGetAppointmentByRange extends AbstractJUnitDefaults {
+	private static final Logger log = Red5LoggerFactory.getLogger(TestDatabaseStructureGetAppointmentByRange.class, getWebAppRootKey());
+
+	@Autowired
+	private AppointmentDao appointmentDao;
+
+	@Test
+	public void test() {
+		log.debug("Test started");
+		Long userId = 1L;
+
+		Calendar now = Calendar.getInstance();
+		Calendar rangeStart = Calendar.getInstance();
+		rangeStart.setTime(now.getTime());
+		rangeStart.add(Calendar.DATE, -1);
+		Calendar rangeEnd = Calendar.getInstance();
+		rangeEnd.add(Calendar.DATE, 1);
+		rangeEnd.setTime(now.getTime());
+
+		Calendar a1End = Calendar.getInstance();
+		a1End.setTime(now.getTime());
+		a1End.add(Calendar.HOUR_OF_DAY, 1);
+		Appointment a1 = getAppointment(now.getTime(), a1End.getTime());
+		a1.setTitle("AppointmentByRange_a1");
+
+		Appointment a2 = getAppointment(now.getTime(), a1End.getTime());
+		a2.setTitle("AppointmentByRange_a2");
+		a2.setMeetingMembers(new ArrayList<MeetingMember>());
+		MeetingMember mm1 = new MeetingMember();
+		mm1.setUser(createUserContact(userId));
+		mm1.setAppointment(a2);
+		a2.getMeetingMembers().add(mm1);
+
+		Appointment a3 = getAppointment(now.getTime(), a1End.getTime());
+		a3.setTitle("AppointmentByRange_a3");
+		a3.setMeetingMembers(new ArrayList<MeetingMember>());
+		MeetingMember mm2 = new MeetingMember();
+		mm2.setUser(createUserContact(userId));
+		mm2.setAppointment(a3);
+		a3.getMeetingMembers().add(mm2);
+		MeetingMember mm3 = new MeetingMember();
+		mm3.setUser(createUserContact(userId));
+		mm3.setAppointment(a3);
+		a3.getMeetingMembers().add(mm3);
+
+		a1 = appointmentDao.update(a1, userId);
+		a2 = appointmentDao.update(a2, userId);
+		a3 = appointmentDao.update(a3, userId);
+
+		int a1found = 0, a2found = 0, a3found = 0;
+		for (Appointment a : appointmentDao.getInRange(userId, rangeStart.getTime(), rangeEnd.getTime())) {
+			int mmCount = a.getMeetingMembers() == null ? 0 : a.getMeetingMembers().size();
+			if (a.getId().equals(a1.getId())) {
+				assertEquals("Inapropriate MeetingMembers count", 0, mmCount);
+				a1found++;
+			}
+			if (a.getId().equals(a2.getId())) {
+				assertEquals("Inapropriate MeetingMembers count", 1, mmCount);
+				a2found++;
+			}
+			if (a.getId().equals(a3.getId())) {
+				assertEquals("Inapropriate MeetingMembers count", 2, mmCount);
+				a3found++;
+			}
+		}
+		assertEquals("Inappropriate count of appointments without members found", 1, a1found);
+		assertEquals("Inappropriate count of appointments with 1 member found", 1, a2found);
+		assertEquals("Inappropriate count of appointments with 2 members found", 1, a3found);
+	}
+}

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/3dac8e2f/openmeetings-web/src/test/java/org/apache/openmeetings/calendar/TestDatabaseStructureGetUserStart.java
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/test/java/org/apache/openmeetings/calendar/TestDatabaseStructureGetUserStart.java b/openmeetings-web/src/test/java/org/apache/openmeetings/calendar/TestDatabaseStructureGetUserStart.java
new file mode 100644
index 0000000..6c7b50c
--- /dev/null
+++ b/openmeetings-web/src/test/java/org/apache/openmeetings/calendar/TestDatabaseStructureGetUserStart.java
@@ -0,0 +1,44 @@
+/*
+ * 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.calendar;
+
+import static org.apache.openmeetings.util.OpenmeetingsVariables.getWebAppRootKey;
+
+import org.apache.openmeetings.AbstractJUnitDefaults;
+import org.apache.openmeetings.db.dao.user.UserDao;
+import org.junit.Test;
+import org.red5.logging.Red5LoggerFactory;
+import org.slf4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class TestDatabaseStructureGetUserStart extends AbstractJUnitDefaults {
+	private static final Logger log = Red5LoggerFactory.getLogger(TestDatabaseStructureGetUserStart.class, getWebAppRootKey());
+
+	@Autowired
+	private UserDao userDao;
+
+	@Test
+	public void testAddingGroup() {
+		try {
+			userDao.get(new Long(1));
+		} catch (Exception err) {
+			log.error("[testAddingGroup]", err);
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/3dac8e2f/openmeetings-web/src/test/java/org/apache/openmeetings/calendar/TestDatabaseStructureMeetingMember.java
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/test/java/org/apache/openmeetings/calendar/TestDatabaseStructureMeetingMember.java b/openmeetings-web/src/test/java/org/apache/openmeetings/calendar/TestDatabaseStructureMeetingMember.java
new file mode 100644
index 0000000..20d3d54
--- /dev/null
+++ b/openmeetings-web/src/test/java/org/apache/openmeetings/calendar/TestDatabaseStructureMeetingMember.java
@@ -0,0 +1,41 @@
+/*
+ * 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.calendar;
+
+
+import org.apache.openmeetings.AbstractJUnitDefaults;
+import org.junit.Test;
+
+
+public class TestDatabaseStructureMeetingMember extends AbstractJUnitDefaults {
+
+	@Test
+	public void testUpdateMeetingMember(){
+		//FIXME need to be refactored !!!!
+
+		//MeetingMemberDaoImpl.getInstance().addMeetingMember("Adddd", "dir", "1", "2", 1L, 1L, "test");
+		//MeetingMemberDaoImpl.getInstance().addMeetingMember(firstname, lastname, memberStatus, appointmentStatus, appointmentId, userid, email)
+
+
+		//MeetingMemberDaoImpl.getInstance().getMeetingMemberById(1L);
+		//MeetingMemberDaoImpl.getInstance().deleteMeetingMember(2L);
+
+		//meetingMemberDao.updateMeetingMember(1l,"bbbbbb", "dir", "1", "2", 1L, 1L, "test", "");
+	}
+}

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/3dac8e2f/openmeetings-web/src/test/java/org/apache/openmeetings/calendar/TestDatabaseStructureUsersSearch.java
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/test/java/org/apache/openmeetings/calendar/TestDatabaseStructureUsersSearch.java b/openmeetings-web/src/test/java/org/apache/openmeetings/calendar/TestDatabaseStructureUsersSearch.java
new file mode 100644
index 0000000..cb6d228
--- /dev/null
+++ b/openmeetings-web/src/test/java/org/apache/openmeetings/calendar/TestDatabaseStructureUsersSearch.java
@@ -0,0 +1,49 @@
+/*
+ * 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.calendar;
+
+import static org.apache.openmeetings.util.OpenmeetingsVariables.getWebAppRootKey;
+import java.util.List;
+
+import org.apache.openmeetings.AbstractJUnitDefaults;
+import org.apache.openmeetings.db.dao.user.UserDao;
+import org.apache.openmeetings.db.entity.user.User;
+import org.junit.Test;
+import org.red5.logging.Red5LoggerFactory;
+import org.slf4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class TestDatabaseStructureUsersSearch extends AbstractJUnitDefaults {
+	private static final Logger log = Red5LoggerFactory.getLogger(TestDatabaseStructureUsersSearch.class, getWebAppRootKey());
+
+	@Autowired
+	private UserDao userDao;
+
+	@Test
+	public void testAddingGroup(){
+		try {
+			 List<User> users = userDao.get("first", 0, 10, "lastname", false, 1L);
+			 log.debug("[result]" + users.size());
+			 log.debug("[records]"+ users);
+		} catch (Exception err) {
+			log.error("[testAddingGroup]",err);
+		}
+	}
+}
+

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/3dac8e2f/openmeetings-web/src/test/java/org/apache/openmeetings/calendar/TestGetAppointment.java
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/test/java/org/apache/openmeetings/calendar/TestGetAppointment.java b/openmeetings-web/src/test/java/org/apache/openmeetings/calendar/TestGetAppointment.java
new file mode 100644
index 0000000..3b907f6
--- /dev/null
+++ b/openmeetings-web/src/test/java/org/apache/openmeetings/calendar/TestGetAppointment.java
@@ -0,0 +1,60 @@
+/*
+ * 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.calendar;
+
+import static org.apache.openmeetings.util.OpenmeetingsVariables.getWebAppRootKey;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.Calendar;
+
+import org.apache.openmeetings.AbstractJUnitDefaults;
+import org.apache.openmeetings.db.dao.calendar.AppointmentDao;
+import org.apache.openmeetings.db.entity.calendar.Appointment;
+import org.junit.Test;
+import org.red5.logging.Red5LoggerFactory;
+import org.slf4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class TestGetAppointment extends AbstractJUnitDefaults {
+	private static final Logger log = Red5LoggerFactory.getLogger(TestGetAppointment.class, getWebAppRootKey());
+
+	@Autowired
+	private AppointmentDao appointmentDao;
+
+	@Test
+	public void getAppoinment() {
+		log.debug("getAppoinment enter");
+		Long userId = 1L;
+
+		Calendar now = Calendar.getInstance();
+		Calendar a1End = Calendar.getInstance();
+		a1End.setTime(now.getTime());
+		a1End.add(Calendar.HOUR_OF_DAY, 1);
+		Appointment a1 = getAppointment(now.getTime(), a1End.getTime());
+		a1.setTitle("GetAppointment");
+
+		a1 = appointmentDao.update(a1, userId);
+
+		Appointment a = appointmentDao.get(a1.getId());
+		assertNotNull("Failed to get Appointment By id", a);
+		assertEquals("Inapropriate MeetingMembers count", 0, a.getMeetingMembers() == null ? 0 : a.getMeetingMembers().size());
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/3dac8e2f/openmeetings-web/src/test/java/org/apache/openmeetings/calendar/TestOmCalendar.java
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/test/java/org/apache/openmeetings/calendar/TestOmCalendar.java b/openmeetings-web/src/test/java/org/apache/openmeetings/calendar/TestOmCalendar.java
new file mode 100644
index 0000000..dbaf91c
--- /dev/null
+++ b/openmeetings-web/src/test/java/org/apache/openmeetings/calendar/TestOmCalendar.java
@@ -0,0 +1,58 @@
+/*
+ * 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.calendar;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.openmeetings.AbstractJUnitDefaults;
+import org.apache.openmeetings.db.dao.calendar.OmCalendarDao;
+import org.apache.openmeetings.db.dao.user.UserDao;
+import org.apache.openmeetings.db.entity.calendar.OmCalendar;
+import org.apache.openmeetings.db.entity.user.User;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class TestOmCalendar extends AbstractJUnitDefaults {
+	@Autowired
+	private OmCalendarDao calendarDao;
+	@Autowired
+	private UserDao userDao;
+
+	@Test
+	public void saveCalendar() {
+		OmCalendar calendar = new OmCalendar();
+		Long userId = 1L;
+		User owner = userDao.get(userId);
+		String title = "Calendar Title", href = "http://caldav.example.com/principals/user";
+
+		calendar.setOwner(owner);
+		calendar.setTitle(title);
+		calendar.setHref(href);
+		calendar.setSyncType(OmCalendar.SyncType.ETAG);
+
+		calendar = calendarDao.update(calendar);
+
+		assertTrue("Saved calendar should have valid id: " + calendar.getId(),
+				calendar.getId() != null && calendar.getId() > 0);
+
+		OmCalendar c = calendarDao.get(calendar.getId());
+		assertNotNull("Failed to find Calendar by id", c);
+	}
+}

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/3dac8e2f/openmeetings-web/src/test/java/org/apache/openmeetings/calendar/TestSendIcalMessage.java
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/test/java/org/apache/openmeetings/calendar/TestSendIcalMessage.java b/openmeetings-web/src/test/java/org/apache/openmeetings/calendar/TestSendIcalMessage.java
new file mode 100644
index 0000000..6c3c81b
--- /dev/null
+++ b/openmeetings-web/src/test/java/org/apache/openmeetings/calendar/TestSendIcalMessage.java
@@ -0,0 +1,235 @@
+/*
+ * 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.calendar;
+
+import static org.apache.openmeetings.util.OpenmeetingsVariables.getWebAppRootKey;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import javax.activation.DataHandler;
+import javax.mail.BodyPart;
+import javax.mail.Message;
+import javax.mail.Multipart;
+import javax.mail.Transport;
+import javax.mail.internet.InternetAddress;
+import javax.mail.internet.MimeBodyPart;
+import javax.mail.internet.MimeMessage;
+import javax.mail.internet.MimeMultipart;
+
+import org.apache.openmeetings.AbstractJUnitDefaults;
+import org.apache.openmeetings.core.mail.MailHandler;
+import org.apache.openmeetings.util.mail.ByteArrayDataSource;
+import org.apache.openmeetings.util.mail.IcalHandler;
+import org.junit.Test;
+import org.red5.logging.Red5LoggerFactory;
+import org.slf4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import net.fortuna.ical4j.data.CalendarOutputter;
+import net.fortuna.ical4j.model.DateTime;
+import net.fortuna.ical4j.model.TimeZone;
+import net.fortuna.ical4j.model.TimeZoneRegistry;
+import net.fortuna.ical4j.model.TimeZoneRegistryFactory;
+import net.fortuna.ical4j.model.component.VEvent;
+import net.fortuna.ical4j.model.component.VTimeZone;
+import net.fortuna.ical4j.model.parameter.Cn;
+import net.fortuna.ical4j.model.parameter.Role;
+import net.fortuna.ical4j.model.property.Attendee;
+import net.fortuna.ical4j.model.property.CalScale;
+import net.fortuna.ical4j.model.property.Method;
+import net.fortuna.ical4j.model.property.Organizer;
+import net.fortuna.ical4j.model.property.ProdId;
+import net.fortuna.ical4j.model.property.Uid;
+import net.fortuna.ical4j.model.property.Version;
+
+public class TestSendIcalMessage extends AbstractJUnitDefaults {
+	private static final Logger log = Red5LoggerFactory.getLogger(TestSendIcalMessage.class, getWebAppRootKey());
+
+	@Autowired
+	private MailHandler mailHandler;
+
+	private byte[] iCalMimeBody;
+
+	String subject = "test iCal";
+	String recipients = "seba.wagner@gmail.com";
+	String htmlBody = "test";
+
+
+	public void simpleInvitionIcalLink() {
+		// Create a TimeZone
+		TimeZoneRegistry registry = TimeZoneRegistryFactory.getInstance().createRegistry();
+		TimeZone timezone = registry.getTimeZone("America/Mexico_City");
+		VTimeZone tz = timezone.getVTimeZone();
+
+		// Start Date is on: April 1, 2008, 9:00 am
+		java.util.Calendar startDate = new GregorianCalendar();
+		startDate.setTimeZone(timezone);
+		startDate.set(java.util.Calendar.MONTH, java.util.Calendar.APRIL);
+		startDate.set(java.util.Calendar.DAY_OF_MONTH, 1);
+		startDate.set(java.util.Calendar.YEAR, 2008);
+		startDate.set(java.util.Calendar.HOUR_OF_DAY, 9);
+		startDate.set(java.util.Calendar.MINUTE, 0);
+		startDate.set(java.util.Calendar.SECOND, 0);
+
+		// End Date is on: April 1, 2008, 13:00
+		java.util.Calendar endDate = new GregorianCalendar();
+		endDate.setTimeZone(timezone);
+		endDate.set(java.util.Calendar.MONTH, java.util.Calendar.APRIL);
+		endDate.set(java.util.Calendar.DAY_OF_MONTH, 1);
+		endDate.set(java.util.Calendar.YEAR, 2008);
+		endDate.set(java.util.Calendar.HOUR_OF_DAY, 13);
+		endDate.set(java.util.Calendar.MINUTE, 0);
+		endDate.set(java.util.Calendar.SECOND, 0);
+
+		// Create the event
+		String eventName = "Progress Meeting";
+		DateTime start = new DateTime(startDate.getTime());
+		DateTime end = new DateTime(endDate.getTime());
+		VEvent meeting = new VEvent(start, end, eventName);
+
+		// add timezone info..
+		meeting.getProperties().add(tz.getTimeZoneId());
+
+		// generate unique identifier..
+		Uid uid = new Uid(UUID.randomUUID().toString());
+		meeting.getProperties().add(uid);
+
+		// add attendees..
+		Attendee dev1 = new Attendee(URI.create("mailto:dev1@mycompany.com"));
+		dev1.getParameters().add(Role.REQ_PARTICIPANT);
+		dev1.getParameters().add(new Cn("Developer 1"));
+		meeting.getProperties().add(dev1);
+
+		Attendee dev2 = new Attendee(URI.create("mailto:dev2@mycompany.com"));
+		dev2.getParameters().add(Role.OPT_PARTICIPANT);
+		dev2.getParameters().add(new Cn("Developer 2"));
+		meeting.getProperties().add(dev2);
+
+		// Create a calendar
+		net.fortuna.ical4j.model.Calendar icsCalendar = new net.fortuna.ical4j.model.Calendar();
+		icsCalendar.getProperties().add(
+				new ProdId("-//Events Calendar//iCal4j 1.0//EN"));
+		icsCalendar.getProperties().add(CalScale.GREGORIAN);
+		icsCalendar.getProperties().add(Version.VERSION_2_0);
+
+		// Add the event and print
+		icsCalendar.getComponents().add(meeting);
+
+		Organizer orger = new Organizer(URI.create("seba.wagner@gmail.com"));
+		orger.getParameters().add(new Cn("Sebastian Wagner"));
+		meeting.getProperties().add(orger);
+
+		icsCalendar.getProperties().add(Method.REQUEST);
+
+		log.debug(icsCalendar.toString());
+
+		ByteArrayOutputStream bout = new ByteArrayOutputStream();
+		CalendarOutputter outputter = new CalendarOutputter();
+		try {
+			outputter.output(icsCalendar, bout);
+			iCalMimeBody = bout.toByteArray();
+
+			sendIcalMessage();
+		} catch (Exception e) {
+			log.error("Error", e);
+		}
+	}
+
+	@Test
+	public void sendInvitionIcalLink() {
+		try {
+			String email = "hans@webbase-design.de";
+			String username = "shans";
+			boolean invitor = false;
+
+			Calendar start = Calendar.getInstance();
+			Calendar end = Calendar.getInstance();
+			IcalHandler handler = new IcalHandler(IcalHandler.ICAL_METHOD_REQUEST);
+
+			// Transforming Meeting Members
+
+			Map<String, String> attendeeList = handler.getAttendeeData(email, username, invitor);
+			Map<String, String> organizerAttendee = handler.getAttendeeData(recipients, "seba-test", true);
+
+			List<Map<String, String>> atts = new ArrayList<>();
+			atts.add(attendeeList);
+
+			// Create ICal Message
+			String meetingId = handler.addNewMeeting(start.getTime(), end.getTime(), "test event",
+					atts, "localhost:5080/link_openmeetings",
+					organizerAttendee, "", java.util.TimeZone.getDefault().getID());
+
+			log.debug("meetingId " + meetingId);
+
+			iCalMimeBody = handler.getIcalAsByteArray();
+
+			sendIcalMessage();
+
+			// return MailHandler.sendMail(email, subject, template);
+
+		} catch (Exception err) {
+			log.error("sendInvitionIcalLink", err);
+		}
+	}
+
+	private void sendIcalMessage() throws Exception {
+		log.debug("sendIcalMessage");
+
+		// Building MimeMessage
+		MimeMessage mimeMessage = mailHandler.getBasicMimeMessage();
+		mimeMessage.setSubject(subject);
+		mimeMessage.addRecipients(Message.RecipientType.TO, InternetAddress.parse(recipients, false));
+
+		// -- Create a new message --
+		BodyPart msg = new MimeBodyPart();
+		msg.setDataHandler(new DataHandler(new ByteArrayDataSource(htmlBody,
+				"text/html; charset=\"utf-8\"")));
+
+		Multipart multipart = new MimeMultipart();
+
+		BodyPart iCalAttachment = new MimeBodyPart();
+		iCalAttachment.setDataHandler(new DataHandler(
+				new javax.mail.util.ByteArrayDataSource(
+						new ByteArrayInputStream(iCalMimeBody),
+						"text/calendar;method=REQUEST;charset=\"UTF-8\"")));
+		iCalAttachment.setFileName("invite.ics");
+
+		multipart.addBodyPart(iCalAttachment);
+		multipart.addBodyPart(msg);
+
+		mimeMessage.setSentDate(new Date());
+		mimeMessage.setContent(multipart);
+
+		// -- Set some other header information --
+		// mimeMessage.setHeader("X-Mailer", "XML-Mail");
+		// mimeMessage.setSentDate(new Date());
+
+		// Transport trans = session.getTransport("smtp");
+		Transport.send(mimeMessage);
+	}
+}

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/3dac8e2f/openmeetings-web/src/test/java/org/apache/openmeetings/config/TestConfig.java
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/test/java/org/apache/openmeetings/config/TestConfig.java b/openmeetings-web/src/test/java/org/apache/openmeetings/config/TestConfig.java
new file mode 100644
index 0000000..ffcc28e
--- /dev/null
+++ b/openmeetings-web/src/test/java/org/apache/openmeetings/config/TestConfig.java
@@ -0,0 +1,74 @@
+/*
+ * 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.config;
+
+import static org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_SMTP_SERVER;
+import static org.apache.openmeetings.util.OpenmeetingsVariables.getWebAppRootKey;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import java.util.List;
+
+import org.apache.openmeetings.AbstractJUnitDefaults;
+import org.apache.openmeetings.db.dao.basic.ConfigurationDao;
+import org.apache.openmeetings.db.entity.basic.Configuration;
+import org.junit.Test;
+import org.red5.logging.Red5LoggerFactory;
+import org.slf4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class TestConfig extends AbstractJUnitDefaults {
+	private static final Logger log = Red5LoggerFactory.getLogger(TestConfig.class, getWebAppRootKey());
+
+	@Autowired
+	private ConfigurationDao configurationDao;
+
+	@Test
+	public void getConfigKey() {
+		System.err.println("THIS");
+
+		Configuration smtp_server = configurationDao.get(CONFIG_SMTP_SERVER);
+
+		System.err.println("smtp_server " + smtp_server.getUser());
+
+		assertNull(smtp_server.getUser());
+	}
+
+	@Test
+	public void getConfigs() {
+
+		try {
+			List<Configuration> list = configurationDao.get(4, 6);
+
+			for (Configuration conf : list) {
+				log.error("conf.getKey() " + conf.getKey());
+				log.error("conf.getUser() " + conf.getUser());
+				if (conf.getUser() != null) {
+					log.error("conf.getUsers() " + conf.getUser().getLogin());
+				}
+			}
+
+			assertEquals(list.size(), 6);
+
+		} catch (Exception err) {
+			log.error("[startConversion]", err);
+		}
+
+	}
+}

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/3dac8e2f/openmeetings-web/src/test/java/org/apache/openmeetings/core/file/TestFileProcessor.java
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/test/java/org/apache/openmeetings/core/file/TestFileProcessor.java b/openmeetings-web/src/test/java/org/apache/openmeetings/core/file/TestFileProcessor.java
new file mode 100644
index 0000000..8a556c4
--- /dev/null
+++ b/openmeetings-web/src/test/java/org/apache/openmeetings/core/file/TestFileProcessor.java
@@ -0,0 +1,58 @@
+/*
+ * 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.core.file;
+
+import static org.apache.openmeetings.util.OmFileHelper.getDefaultProfilePicture;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.util.UUID;
+
+import org.apache.openmeetings.AbstractJUnitDefaults;
+import org.apache.openmeetings.core.data.file.FileProcessor;
+import org.apache.openmeetings.db.dto.file.FileItemDTO;
+import org.apache.openmeetings.db.entity.file.BaseFileItem;
+import org.apache.openmeetings.db.entity.file.FileItem;
+import org.apache.openmeetings.util.process.ConverterProcessResultList;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class TestFileProcessor extends AbstractJUnitDefaults {
+	private static final String FILE_NAME = "test_name";
+
+	@Autowired
+	protected FileProcessor processor;
+
+	@Test
+	public void testProcessJpeg() throws Exception {
+		for (String ext : new String[] {null, "txt", "png"}) {
+			FileItem f = new FileItemDTO()
+					.setName(String.format("%s.%s", FILE_NAME, ext))
+					.setHash(UUID.randomUUID().toString())
+					.setType(BaseFileItem.Type.Recording).get();
+			try (InputStream is = new FileInputStream(getDefaultProfilePicture())) {
+				ConverterProcessResultList result = processor.processFile(f, is);
+				assertFalse("Conversion should be successful", result.hasError());
+				assertEquals("Type should be image", BaseFileItem.Type.Image, f.getType());
+			}
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/3dac8e2f/openmeetings-web/src/test/java/org/apache/openmeetings/derby/PrepareSystemFiles.java
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/test/java/org/apache/openmeetings/derby/PrepareSystemFiles.java b/openmeetings-web/src/test/java/org/apache/openmeetings/derby/PrepareSystemFiles.java
new file mode 100644
index 0000000..6c142f0
--- /dev/null
+++ b/openmeetings-web/src/test/java/org/apache/openmeetings/derby/PrepareSystemFiles.java
@@ -0,0 +1,67 @@
+/*
+ * 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.derby;
+
+import static org.apache.openmeetings.util.OpenmeetingsVariables.getWebAppRootKey;
+
+import java.io.File;
+
+import org.apache.openmeetings.cli.ConnectionPropertiesPatcher;
+import org.apache.openmeetings.util.ConnectionProperties.DbType;
+import org.apache.openmeetings.util.OmFileHelper;
+import org.red5.logging.Red5LoggerFactory;
+import org.slf4j.Logger;
+
+/**
+ * This file is called from command line to patch the derby configuration
+ * during the automated run of Selenium
+ *
+ * @author swagner
+ *
+ */
+public class PrepareSystemFiles {
+	private static final Logger log = Red5LoggerFactory.getLogger(PrepareSystemFiles.class, getWebAppRootKey());
+
+	public static void main(String... args) {
+		try {
+			OmFileHelper.setOmHome(args[0]);
+
+			String databaseHomeDirectory = args[1];
+
+			String persistanceFileToPatch = args[2];
+
+			File conf = new File(persistanceFileToPatch);
+
+			if (conf.exists()) {
+				conf.delete();
+			}
+
+			ConnectionPropertiesPatcher.patch(DbType.derby.name()
+					, "localhost"
+					, "1527"
+					, databaseHomeDirectory + "openmeetings"
+					, "user"
+					, "secret"
+					);
+		} catch (Exception err) {
+			log.error("Error", err);
+		}
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/3dac8e2f/openmeetings-web/src/test/java/org/apache/openmeetings/domain/TestAddGroup.java
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/test/java/org/apache/openmeetings/domain/TestAddGroup.java b/openmeetings-web/src/test/java/org/apache/openmeetings/domain/TestAddGroup.java
new file mode 100644
index 0000000..552b900
--- /dev/null
+++ b/openmeetings-web/src/test/java/org/apache/openmeetings/domain/TestAddGroup.java
@@ -0,0 +1,60 @@
+/*
+ * 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.domain;
+
+import static org.apache.openmeetings.util.OpenmeetingsVariables.getWebAppRootKey;
+import static org.junit.Assert.assertNotNull;
+
+import org.apache.openmeetings.AbstractJUnitDefaults;
+import org.apache.openmeetings.db.dao.user.GroupDao;
+import org.apache.openmeetings.db.dao.user.UserDao;
+import org.apache.openmeetings.db.entity.user.Group;
+import org.apache.openmeetings.db.entity.user.GroupUser;
+import org.apache.openmeetings.db.entity.user.User;
+import org.junit.Test;
+import org.red5.logging.Red5LoggerFactory;
+import org.slf4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class TestAddGroup extends AbstractJUnitDefaults {
+	private static final Logger log = Red5LoggerFactory.getLogger(TestAddGroup.class, getWebAppRootKey());
+
+	@Autowired
+	private GroupDao groupDao;
+	@Autowired
+	private UserDao userDao;
+
+	@Test
+	public void testAddingGroup() {
+		Group o = new Group();
+		o.setName("default");
+		o = groupDao.update(o, null);
+		assertNotNull("Id of group created should not be null", o.getId());
+
+		User us = userDao.get(1L);
+		assertNotNull("User should exist", us);
+
+		assertNotNull("Group User list should exist", us.getGroupUsers());
+		us.getGroupUsers().add(new GroupUser(o, us));
+		us = userDao.update(us, null);
+
+		log.error(us.getLastname());
+		log.error(us.getAddress().getTown());
+	}
+}

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/3dac8e2f/openmeetings-web/src/test/java/org/apache/openmeetings/domain/TestUserGroupAggregation.java
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/test/java/org/apache/openmeetings/domain/TestUserGroupAggregation.java b/openmeetings-web/src/test/java/org/apache/openmeetings/domain/TestUserGroupAggregation.java
new file mode 100644
index 0000000..accdcd0
--- /dev/null
+++ b/openmeetings-web/src/test/java/org/apache/openmeetings/domain/TestUserGroupAggregation.java
@@ -0,0 +1,51 @@
+/*
+ * 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.domain;
+
+import static org.apache.openmeetings.util.OpenmeetingsVariables.getWebAppRootKey;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.openmeetings.AbstractJUnitDefaults;
+import org.apache.openmeetings.db.dao.user.UserDao;
+import org.apache.openmeetings.db.entity.user.GroupUser;
+import org.apache.openmeetings.db.entity.user.User;
+import org.junit.Test;
+import org.red5.logging.Red5LoggerFactory;
+import org.slf4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class TestUserGroupAggregation extends AbstractJUnitDefaults {
+	private static final Logger log = Red5LoggerFactory.getLogger(TestUserGroupAggregation.class, getWebAppRootKey());
+
+	@Autowired
+	private UserDao userDao;
+
+	@Test
+	public void testitNow() {
+		User u = userDao.get(1L);
+
+		assertNotNull("Group list for default user must not be null", u.getGroupUsers());
+		assertTrue("Default user must belong to at least one group", u.getGroupUsers().size() > 0);
+
+		for (GroupUser orgUserObj : u.getGroupUsers()) {
+			log.error("testitNow: group Id: '" + orgUserObj.getGroup().getId() + "'; name: '" + orgUserObj.getGroup().getName() + "'");
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/3dac8e2f/openmeetings-web/src/test/java/org/apache/openmeetings/invitiation/TestInvitation.java
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/test/java/org/apache/openmeetings/invitiation/TestInvitation.java b/openmeetings-web/src/test/java/org/apache/openmeetings/invitiation/TestInvitation.java
new file mode 100644
index 0000000..e0152b7
--- /dev/null
+++ b/openmeetings-web/src/test/java/org/apache/openmeetings/invitiation/TestInvitation.java
@@ -0,0 +1,57 @@
+/*
+ * 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.invitiation;
+
+import static org.apache.openmeetings.util.CalendarHelper.getDate;
+
+import java.time.LocalDateTime;
+
+import org.apache.openmeetings.AbstractWicketTester;
+import org.apache.openmeetings.db.dao.room.RoomDao;
+import org.apache.openmeetings.db.dao.user.UserDao;
+import org.apache.openmeetings.db.entity.room.Invitation;
+import org.apache.openmeetings.db.entity.room.Invitation.MessageType;
+import org.apache.openmeetings.db.entity.room.Invitation.Valid;
+import org.apache.openmeetings.db.entity.user.User;
+import org.apache.openmeetings.service.room.InvitationManager;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class TestInvitation extends AbstractWicketTester {
+	@Autowired
+	private InvitationManager invitationManager;
+	@Autowired
+	private UserDao userDao;
+	@Autowired
+	private RoomDao roomDao;
+
+	@Test
+	public void testSendInvitationLink() throws Exception {
+		User us = userDao.getByLogin(username, User.Type.user, null);
+
+		LocalDateTime from = LocalDateTime.now().plusDays(1).withHour(12).withMinute(0).withSecond(0);
+		User invitee = userDao.getContact("sebawagner@apache.org", "Testname", "Testlastname", us.getId());
+		Invitation i = invitationManager.getInvitation(invitee, roomDao.get(1L),
+				false, "", Valid.OneTime
+				, us, us.getLanguageId(),
+				getDate(from, "GMT"), getDate(from.plusHours(2), "GMT"), null);
+
+		invitationManager.sendInvitationLink(i, MessageType.Create, "subject", "message", false);
+	}
+}