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:27 UTC
[3/4] openmeetings git commit: [OPENMEETINGS-1714] more issues are
fixed
http://git-wip-us.apache.org/repos/asf/openmeetings/blob/3dac8e2f/openmeetings-web/src/test/java/org/apache/openmeetings/selenium/AbstractTestDefaults.java
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/test/java/org/apache/openmeetings/selenium/AbstractTestDefaults.java b/openmeetings-web/src/test/java/org/apache/openmeetings/selenium/AbstractTestDefaults.java
new file mode 100644
index 0000000..af854f4
--- /dev/null
+++ b/openmeetings-web/src/test/java/org/apache/openmeetings/selenium/AbstractTestDefaults.java
@@ -0,0 +1,229 @@
+/*
+ * 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.selenium;
+
+import java.util.List;
+
+import org.apache.openmeetings.AbstractSpringTest;
+import org.apache.openmeetings.db.dao.label.LabelDao;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.experimental.categories.Category;
+import org.openqa.selenium.Keys;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.firefox.FirefoxDriver;
+import org.openqa.selenium.firefox.FirefoxOptions;
+import org.openqa.selenium.firefox.FirefoxProfile;
+
+@Category(SeleniumTests.class)
+public abstract class AbstractTestDefaults extends AbstractSpringTest {
+ public WebDriver driver = null;
+
+ private String BASE_URL = "http://localhost:5080/openmeetings";
+ private String username = "swagner";
+ private String userpass = "qweqwe";
+ private String groupName = "seleniumtest";
+ private String email = "selenium@openmeetings.apache.org";
+ private String locale = "en-us";
+
+
+ public String getBASE_URL() {
+ return BASE_URL;
+ }
+
+ public String getUsername() {
+ return username;
+ }
+
+ public String getUserpass() {
+ return userpass;
+ }
+
+ public String getGroupName() {
+ return groupName;
+ }
+
+ public String getEmail() {
+ return email;
+ }
+
+ public Long getLanguageId() {
+ return 1L;
+ }
+
+ public String getLocale() {
+ return locale;
+ }
+
+ // setting this to false can be handy if you run the test from inside
+ // Eclipse, the browser will not shut down after the test so you can start
+ // to diagnose the test issue
+ public boolean doTearDownAfterTest = false;
+
+ public String getString(String key) {
+ return LabelDao.getString(key, getLanguageId());
+ }
+
+ /**
+ * Make method overwrite possible to have custom behavior in tests
+ *
+ * @return
+ */
+ public boolean getDoTearDownAfterTest() {
+ return doTearDownAfterTest;
+ }
+
+ @Before
+ public void setUp() {
+ FirefoxProfile profile = new FirefoxProfile();
+ profile.setPreference("intl.accept_languages", getLocale());
+ driver = new FirefoxDriver(new FirefoxOptions().setProfile(profile));
+ }
+
+ /**
+ * This test is a basic test to verify the default loader mechanism works
+ * it is not intend to be a part of any sub test
+ *
+ * @throws Exception
+ */
+ //@Test
+ public void smokeTest() throws Exception {
+ try {
+ driver.get(getBASE_URL());
+
+ testIsInstalledAndDoInstallation();
+
+ SeleniumUtils.inputText(driver, "login", getUsername());
+ SeleniumUtils.inputText(driver, "pass", getUserpass());
+
+ WebElement signInButton = SeleniumUtils.findElement(driver,
+ "//button[span[contains(text(), 'Sign in')]]", true, true);
+ signInButton.click();
+
+ SeleniumUtils.elementExists(driver,
+ "//h3[contains(text(), 'Help and support')]", true);
+ } catch (Exception e) {
+ SeleniumUtils.makeScreenShot(this.getClass().getSimpleName(), e,
+ driver);
+ throw e;
+ }
+ }
+
+ /**
+ * Throws exception in case that test fails, so it is important to not catch
+ * that exception but really let the test fail!
+ *
+ * @throws Exception
+ */
+ protected void testIsInstalledAndDoInstallation() throws Exception {
+
+ WebElement wicketExtensionsWizardHeaderTitle = SeleniumUtils
+ .findElement(driver, "wicketExtensionsWizardHeaderTitle", false, true);
+ if (wicketExtensionsWizardHeaderTitle == null) {
+ return;
+ }
+ if (wicketExtensionsWizardHeaderTitle.getText()
+ .contains("Installation")) {
+ System.out.println("Do Installation");
+ doInstallation();
+ }
+
+ }
+
+ private void doInstallation() throws Exception {
+ Thread.sleep(3000L);
+
+ List<WebElement> buttons_next = SeleniumUtils.findElements(driver,
+ "buttons:next", true);
+
+ buttons_next.get(1).sendKeys(Keys.RETURN);
+
+ Thread.sleep(1000L);
+
+ SeleniumUtils.inputText(driver, "view:cfg.username", getUsername());
+ SeleniumUtils.inputText(driver, "view:cfg.password", getUserpass());
+ SeleniumUtils.inputText(driver, "view:cfg.email", getEmail());
+ SeleniumUtils.inputText(driver, "view:cfg.group", getGroupName());
+
+ buttons_next = SeleniumUtils.findElements(driver, "buttons:next", true);
+
+ buttons_next.get(1).sendKeys(Keys.RETURN);
+
+ Thread.sleep(1000L);
+
+ buttons_next = SeleniumUtils.findElements(driver, "buttons:next", true);
+
+ buttons_next.get(1).sendKeys(Keys.RETURN);
+
+ Thread.sleep(1000L);
+
+ buttons_next = SeleniumUtils.findElements(driver, "buttons:next", true);
+
+ buttons_next.get(1).sendKeys(Keys.RETURN);
+
+ Thread.sleep(1000L);
+
+ buttons_next = SeleniumUtils.findElements(driver, "buttons:next", true);
+
+ buttons_next.get(1).sendKeys(Keys.RETURN);
+
+ Thread.sleep(2000L);
+
+ List<WebElement> elements = SeleniumUtils.findElements(driver,
+ "buttons:finish", true);
+
+ elements.get(1).sendKeys(Keys.RETURN);
+
+ long maxMilliSecondsWait = 120000;
+
+ while (maxMilliSecondsWait > 0) {
+
+ // check if installation is complete by searching for the link on
+ // the success page
+ WebElement enterApplicationLink = SeleniumUtils.findElement(driver,
+ "//a[contains(@href,'install')]", false, true);
+
+ if (enterApplicationLink == null) {
+ System.out
+ .println("Installation running - wait 3 more seconds and check again");
+
+ Thread.sleep(3000L);
+ maxMilliSecondsWait -= 3000;
+ } else {
+ maxMilliSecondsWait = 0;
+
+ enterApplicationLink.click();
+
+ return;
+ }
+ }
+
+ throw new Exception("Timeout during installation");
+ }
+
+ @After
+ public void tearDown() {
+ if (getDoTearDownAfterTest()) {
+ driver.close();
+ driver.quit();
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/openmeetings/blob/3dac8e2f/openmeetings-web/src/test/java/org/apache/openmeetings/selenium/HeavyTests.java
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/test/java/org/apache/openmeetings/selenium/HeavyTests.java b/openmeetings-web/src/test/java/org/apache/openmeetings/selenium/HeavyTests.java
new file mode 100644
index 0000000..a1eaca6
--- /dev/null
+++ b/openmeetings-web/src/test/java/org/apache/openmeetings/selenium/HeavyTests.java
@@ -0,0 +1,23 @@
+/*
+ * 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.selenium;
+
+public @interface HeavyTests {
+
+}
http://git-wip-us.apache.org/repos/asf/openmeetings/blob/3dac8e2f/openmeetings-web/src/test/java/org/apache/openmeetings/selenium/SeleniumTests.java
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/test/java/org/apache/openmeetings/selenium/SeleniumTests.java b/openmeetings-web/src/test/java/org/apache/openmeetings/selenium/SeleniumTests.java
new file mode 100644
index 0000000..5b4351c
--- /dev/null
+++ b/openmeetings-web/src/test/java/org/apache/openmeetings/selenium/SeleniumTests.java
@@ -0,0 +1,23 @@
+/*
+ * 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.selenium;
+
+public @interface SeleniumTests {
+
+}
http://git-wip-us.apache.org/repos/asf/openmeetings/blob/3dac8e2f/openmeetings-web/src/test/java/org/apache/openmeetings/selenium/SeleniumUtils.java
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/test/java/org/apache/openmeetings/selenium/SeleniumUtils.java b/openmeetings-web/src/test/java/org/apache/openmeetings/selenium/SeleniumUtils.java
new file mode 100644
index 0000000..8b860a8
--- /dev/null
+++ b/openmeetings-web/src/test/java/org/apache/openmeetings/selenium/SeleniumUtils.java
@@ -0,0 +1,229 @@
+/*
+ * 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.selenium;
+
+import static org.apache.openmeetings.util.OpenmeetingsVariables.getWebAppRootKey;
+
+import java.io.File;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+
+import org.apache.commons.io.FileUtils;
+import org.openqa.selenium.By;
+import org.openqa.selenium.OutputType;
+import org.openqa.selenium.TakesScreenshot;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.red5.logging.Red5LoggerFactory;
+import org.slf4j.Logger;
+
+public class SeleniumUtils {
+ private static final Logger log = Red5LoggerFactory.getLogger(SeleniumUtils.class, getWebAppRootKey());
+ // we need to retry some actions because our web site is dynamic
+ static int numberOfRetries = 10;
+
+ // we need to sleep to make sure Ajax could complete whatever it does
+ static long defaultSleepInterval = 1000;
+
+ public static void inputText(WebDriver driver, String search,
+ String inputText) throws Exception {
+ WebElement element = SeleniumUtils.findElement(driver, search, true, true);
+
+ //clear text before adding input
+ element.clear();
+
+ // Would make send to check if this element is really an input text
+ element.sendKeys(inputText);
+ }
+
+ public static void click(WebDriver driver, String search) throws Exception {
+ WebElement element = SeleniumUtils.findElement(driver, search, true, true);
+ element.click();
+ }
+
+ /**
+ *
+ * @param driver
+ * @param search
+ * @param throwException
+ * under some circumstance you do't want to exit the test here
+ * @return
+ * @throws Exception
+ */
+ public static List<WebElement> findElements(WebDriver driver, String search,
+ boolean throwException) throws Exception {
+ for (int i = 0; i < numberOfRetries; i++) {
+ List<WebElement> elements = _findElement(driver, search);
+ if (elements != null) {
+ return elements;
+ }
+
+ Thread.sleep(defaultSleepInterval);
+ }
+
+ if (throwException) {
+ throw new Exception("Could not find element with specified path "
+ + search);
+ }
+
+ return null;
+ }
+
+ /**
+ *
+ * @param driver
+ * @param search
+ * @param throwException
+ * under some circumstance you do't want to exit the test here
+ * @param onlyReturnVisisbleElement TODO
+ * @return
+ * @throws Exception
+ */
+ public static WebElement findElement(WebDriver driver, String search,
+ boolean throwException, boolean onlyReturnVisisbleElement) throws Exception {
+ for (int i = 0; i < numberOfRetries; i++) {
+ List<WebElement> elements = _findElement(driver, search);
+ if (elements != null) {
+
+ if (!onlyReturnVisisbleElement) {
+ return elements.get(0);
+ }
+
+ for (WebElement element : elements) {
+ if (element.isDisplayed()) {
+ return element;
+ }
+ }
+
+ }
+
+ Thread.sleep(defaultSleepInterval);
+ }
+
+ if (throwException) {
+ throw new Exception("Could not find element with specified path "
+ + search);
+ }
+
+ return null;
+ }
+
+ private static By[] _getSearchArray(String search) {
+ //If xpath we have to use it, if xpath is used with By.className(...) there will be an exception
+ if (search.startsWith("//")) {
+ return new By[] { By.xpath(search) };
+ } else {
+ return new By[] { By.id(search), By.name(search), By.className(search),
+ By.tagName(search), By.xpath(search) };
+ }
+ }
+
+ private static List<WebElement> _findElement(WebDriver driver, String search) {
+ for (By by : _getSearchArray(search)) {
+ try {
+ List<WebElement> elements = driver.findElements(by);
+ if (elements != null && elements.size() > 0) {
+ return elements;
+ }
+ } catch (Exception e) {
+ // Do not show any warnings
+ }
+ }
+ return null;
+ }
+
+ public static void elementExists(WebDriver driver, String search,
+ boolean shouldExist) throws Exception {
+ Thread.sleep(defaultSleepInterval);
+
+ boolean doesExist = !shouldExist;
+
+ for (int i = 0; i < numberOfRetries; i++) {
+ doesExist = checkExists(driver, search);
+ if (doesExist == shouldExist) {
+ break;
+ }
+
+ Thread.sleep(defaultSleepInterval);
+ }
+
+ if (doesExist != shouldExist) {
+ if (shouldExist) {
+ throw new Exception("Element could not be found: " + search);
+ } else {
+ throw new Exception("Unexpected Element was found: " + search);
+ }
+ }
+ }
+
+ private static boolean checkExists(WebDriver driver, String search) {
+ for (By by : _getSearchArray(search)) {
+ try {
+ List<WebElement> element = driver.findElements(by);
+ if (element.size() > 0) {
+ return true;
+ }
+ } catch (Exception e) {
+ // Do not show any warnings
+ }
+ }
+ return false;
+ }
+
+ public static void makeScreenShot(String testName, Exception e,
+ WebDriver driver) {
+ try {
+ DateFormat df = new SimpleDateFormat("MM-dd-yyyy_HH-mm-ss");
+ String fileName = e.getMessage().replace(" ", "_");
+ fileName = fileName.replaceAll("(\r\n|\n)", "");
+ fileName = fileName.replaceAll("/", "");
+
+ if (fileName.length() > 100) {
+ fileName = fileName.substring(0, 100);
+ }
+
+ fileName = fileName + "_" + df.format(new Date()) + ".png";
+ File screenShotFile = ((TakesScreenshot) driver)
+ .getScreenshotAs(OutputType.FILE);
+
+ String path = "." + File.separatorChar + "build"
+ + File.separatorChar + "screenshots" + File.separatorChar
+ + testName;
+
+ File screenshotFolder = new File(path);
+ if (!screenshotFolder.exists()) {
+ screenshotFolder.mkdirs();
+ }
+
+ System.out.println("screenshot copy from: "
+ + screenShotFile.getAbsolutePath());
+ System.out.println("Length Filename: " + fileName.length()
+ + " - Writing screenshot to: " + path + File.separatorChar
+ + fileName);
+
+ FileUtils.moveFile(screenShotFile, new File(path
+ + File.separatorChar + fileName));
+ } catch (Exception err) {
+ log.error("Error", err);
+ }
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/openmeetings/blob/3dac8e2f/openmeetings-web/src/test/java/org/apache/openmeetings/selenium/TestSignUp.java
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/test/java/org/apache/openmeetings/selenium/TestSignUp.java b/openmeetings-web/src/test/java/org/apache/openmeetings/selenium/TestSignUp.java
new file mode 100644
index 0000000..4ee6d17
--- /dev/null
+++ b/openmeetings-web/src/test/java/org/apache/openmeetings/selenium/TestSignUp.java
@@ -0,0 +1,128 @@
+/*
+ * 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.selenium;
+
+import java.util.Date;
+
+import org.junit.Test;
+import org.openqa.selenium.Alert;
+import org.openqa.selenium.WebElement;
+
+import com.googlecode.wicket.jquery.ui.widget.dialog.DialogButtons;
+
+public class TestSignUp extends AbstractTestDefaults {
+ String pass = "pass";
+
+ @Override
+ public boolean getDoTearDownAfterTest() {
+ return false;
+ }
+
+ @Test
+ public void testSignUp() throws Exception {
+ try {
+ driver.get(getBASE_URL());
+
+ String currentRandomCounter = "" + ((new Date().getTime())/1000);
+ String userName = "seba" + currentRandomCounter;
+ String email = "hans." + currentRandomCounter + "@openmeetings.apache.org";
+
+ super.testIsInstalledAndDoInstallation();
+
+ WebElement signUpButton = SeleniumUtils.findElement(driver,
+ "//button[span[contains(text(), '" + getString("123") + "')]]", true, true);
+ signUpButton.click();
+
+ // ##################################
+ // Test validation message for passwords to be identical
+ // ##################################
+ doSignUp("Hans","Muster", userName, "pw", "pw2", email);
+
+ //Find Error label-id 232 "Please enter two identical passwords"
+ SeleniumUtils.findElement(driver, "//span[@class='feedbackPanelERROR'][contains(text(), '" + getString("232") + "')]", true, true);
+
+ // ##################################
+ // Sign up with user and sign in
+ // ##################################
+ doSignUp("Hans","Muster", userName, pass, pass, email);
+
+ //Check for popup with success message and email to check
+ SeleniumUtils.findElement(driver, "//span[contains(text(), '" + getString("warn.notverified") + "')]", true, true);
+
+ //click button to close popup
+ WebElement signUpSucessPopUpOkButton = SeleniumUtils.findElement(driver,
+ "//button[span[contains(text(), '" + DialogButtons.OK.toString() + "')]]", true, true);
+ signUpSucessPopUpOkButton.click();
+
+ //Login with user
+ SeleniumUtils.inputText(driver, "login", userName);
+ SeleniumUtils.inputText(driver, "pass", pass);
+
+ //click labelid 112 "Sign In"
+ WebElement signInButton = SeleniumUtils.findElement(driver,
+ "//button[span[contains(text(), '" + getString("112") + "')]]", true, true);
+ signInButton.click();
+
+ // check for some text in dashbaord, labelid 281, "Help and support"
+ SeleniumUtils.elementExists(driver,
+ "//h3[contains(text(), '" + getString("281") + "')]", true);
+
+ //sign out
+ WebElement signOutLink = SeleniumUtils.findElement(driver,
+ "//a[contains(text(), '" + getString("310") + "')]", true, true);
+ signOutLink.click();
+
+ Alert alert = driver.switchTo().alert();
+ alert.accept();
+
+ // ##################################
+ // Sign up with same user and email and check duplicate messages
+ // ##################################
+
+ signUpButton = SeleniumUtils.findElement(driver,
+ "//button[span[contains(text(), '" + getString("123") + "')]]", true, true);
+ signUpButton.click();
+
+ doSignUp("Hans","Muster", userName, pass, pass, email);
+
+ SeleniumUtils.findElement(driver, "//span[@class='feedbackPanelERROR'][contains(text(), '" + getString("error.login.inuse") + "')]", true, true);
+
+ SeleniumUtils.findElement(driver, "//span[@class='feedbackPanelERROR'][contains(text(), '" + getString("error.email.inuse") + "')]", true, true);
+ } catch (Exception e) {
+ SeleniumUtils.makeScreenShot(this.getClass().getSimpleName(), e,
+ driver);
+ throw e;
+ }
+ }
+
+ private void doSignUp(String firstName, String lastName, String login, String password,
+ String confirmPassword, String email) throws Exception {
+
+ SeleniumUtils.inputText(driver, "firstName", firstName);
+ SeleniumUtils.inputText(driver, "lastName", lastName);
+ SeleniumUtils.inputText(driver, "//input[@name='login']", login);
+ SeleniumUtils.inputText(driver, "password", password);
+ SeleniumUtils.inputText(driver, "confirmPassword", confirmPassword);
+ SeleniumUtils.inputText(driver, "email", email);
+
+ WebElement submitButton = SeleniumUtils.findElement(driver,
+ "//button[span[contains(text(), 'Register')]]", true, true);
+ submitButton.click();
+ }
+}
http://git-wip-us.apache.org/repos/asf/openmeetings/blob/3dac8e2f/openmeetings-web/src/test/java/org/apache/openmeetings/smoke/TestSmokeBasic.java
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/test/java/org/apache/openmeetings/smoke/TestSmokeBasic.java b/openmeetings-web/src/test/java/org/apache/openmeetings/smoke/TestSmokeBasic.java
new file mode 100644
index 0000000..9a8b2cc
--- /dev/null
+++ b/openmeetings-web/src/test/java/org/apache/openmeetings/smoke/TestSmokeBasic.java
@@ -0,0 +1,36 @@
+/*
+ * 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.smoke;
+
+import static org.junit.Assert.assertNotNull;
+
+import org.apache.openmeetings.AbstractJUnitDefaults;
+import org.apache.openmeetings.db.dao.user.UserDao;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class TestSmokeBasic extends AbstractJUnitDefaults {
+ @Autowired
+ private UserDao userDao;
+
+ @Test
+ public void createErrorValueAndTest() {
+ assertNotNull(userDao.get(1L));
+ }
+}
http://git-wip-us.apache.org/repos/asf/openmeetings/blob/3dac8e2f/openmeetings-web/src/test/java/org/apache/openmeetings/test/AbstractJUnitDefaults.java
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/test/java/org/apache/openmeetings/test/AbstractJUnitDefaults.java b/openmeetings-web/src/test/java/org/apache/openmeetings/test/AbstractJUnitDefaults.java
deleted file mode 100644
index 218b68a..0000000
--- a/openmeetings-web/src/test/java/org/apache/openmeetings/test/AbstractJUnitDefaults.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * 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;
-
-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/test/AbstractSpringTest.java
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/test/java/org/apache/openmeetings/test/AbstractSpringTest.java b/openmeetings-web/src/test/java/org/apache/openmeetings/test/AbstractSpringTest.java
deleted file mode 100644
index c91eb34..0000000
--- a/openmeetings-web/src/test/java/org/apache/openmeetings/test/AbstractSpringTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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;
-
-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/test/AbstractWicketTester.java
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/test/java/org/apache/openmeetings/test/AbstractWicketTester.java b/openmeetings-web/src/test/java/org/apache/openmeetings/test/AbstractWicketTester.java
deleted file mode 100644
index 5d2ab66..0000000
--- a/openmeetings-web/src/test/java/org/apache/openmeetings/test/AbstractWicketTester.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * 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;
-
-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/test/backup/TestOldBackups.java
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/test/java/org/apache/openmeetings/test/backup/TestOldBackups.java b/openmeetings-web/src/test/java/org/apache/openmeetings/test/backup/TestOldBackups.java
deleted file mode 100644
index f82ff95..0000000
--- a/openmeetings-web/src/test/java/org/apache/openmeetings/test/backup/TestOldBackups.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * 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.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.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.apache.openmeetings.test.AbstractJUnitDefaults;
-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/test/calendar/TestAppointmentAddAppointment.java
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/test/java/org/apache/openmeetings/test/calendar/TestAppointmentAddAppointment.java b/openmeetings-web/src/test/java/org/apache/openmeetings/test/calendar/TestAppointmentAddAppointment.java
deleted file mode 100644
index b1cee5b..0000000
--- a/openmeetings-web/src/test/java/org/apache/openmeetings/test/calendar/TestAppointmentAddAppointment.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * 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.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.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.test.AbstractWicketTester;
-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/test/calendar/TestAppointmentSchedulerTask.java
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/test/java/org/apache/openmeetings/test/calendar/TestAppointmentSchedulerTask.java b/openmeetings-web/src/test/java/org/apache/openmeetings/test/calendar/TestAppointmentSchedulerTask.java
deleted file mode 100644
index 887ff90..0000000
--- a/openmeetings-web/src/test/java/org/apache/openmeetings/test/calendar/TestAppointmentSchedulerTask.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.calendar;
-
-import static org.apache.openmeetings.util.OpenmeetingsVariables.getWebAppRootKey;
-import static org.junit.Assert.assertTrue;
-
-import org.apache.openmeetings.service.calendar.AppointmentLogic;
-import org.apache.openmeetings.test.AbstractJUnitDefaults;
-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/test/calendar/TestDatabaseStructureAppointment.java
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/test/java/org/apache/openmeetings/test/calendar/TestDatabaseStructureAppointment.java b/openmeetings-web/src/test/java/org/apache/openmeetings/test/calendar/TestDatabaseStructureAppointment.java
deleted file mode 100644
index 84a2cf8..0000000
--- a/openmeetings-web/src/test/java/org/apache/openmeetings/test/calendar/TestDatabaseStructureAppointment.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * 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.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.db.dao.calendar.AppointmentDao;
-import org.apache.openmeetings.db.entity.calendar.Appointment;
-import org.apache.openmeetings.test.AbstractJUnitDefaults;
-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/test/calendar/TestDatabaseStructureGetAppointmentByRange.java
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/test/java/org/apache/openmeetings/test/calendar/TestDatabaseStructureGetAppointmentByRange.java b/openmeetings-web/src/test/java/org/apache/openmeetings/test/calendar/TestDatabaseStructureGetAppointmentByRange.java
deleted file mode 100644
index e20cd3f..0000000
--- a/openmeetings-web/src/test/java/org/apache/openmeetings/test/calendar/TestDatabaseStructureGetAppointmentByRange.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * 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.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.db.dao.calendar.AppointmentDao;
-import org.apache.openmeetings.db.entity.calendar.Appointment;
-import org.apache.openmeetings.db.entity.calendar.MeetingMember;
-import org.apache.openmeetings.test.AbstractJUnitDefaults;
-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/test/calendar/TestDatabaseStructureGetUserStart.java
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/test/java/org/apache/openmeetings/test/calendar/TestDatabaseStructureGetUserStart.java b/openmeetings-web/src/test/java/org/apache/openmeetings/test/calendar/TestDatabaseStructureGetUserStart.java
deleted file mode 100644
index 8be42f2..0000000
--- a/openmeetings-web/src/test/java/org/apache/openmeetings/test/calendar/TestDatabaseStructureGetUserStart.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.calendar;
-
-import static org.apache.openmeetings.util.OpenmeetingsVariables.getWebAppRootKey;
-
-import org.apache.openmeetings.db.dao.user.UserDao;
-import org.apache.openmeetings.test.AbstractJUnitDefaults;
-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/test/calendar/TestDatabaseStructureMeetingMember.java
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/test/java/org/apache/openmeetings/test/calendar/TestDatabaseStructureMeetingMember.java b/openmeetings-web/src/test/java/org/apache/openmeetings/test/calendar/TestDatabaseStructureMeetingMember.java
deleted file mode 100644
index 08a0149..0000000
--- a/openmeetings-web/src/test/java/org/apache/openmeetings/test/calendar/TestDatabaseStructureMeetingMember.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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.calendar;
-
-
-import org.apache.openmeetings.test.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/test/calendar/TestDatabaseStructureUsersSearch.java
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/test/java/org/apache/openmeetings/test/calendar/TestDatabaseStructureUsersSearch.java b/openmeetings-web/src/test/java/org/apache/openmeetings/test/calendar/TestDatabaseStructureUsersSearch.java
deleted file mode 100644
index c928ac1..0000000
--- a/openmeetings-web/src/test/java/org/apache/openmeetings/test/calendar/TestDatabaseStructureUsersSearch.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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.calendar;
-
-import static org.apache.openmeetings.util.OpenmeetingsVariables.getWebAppRootKey;
-import java.util.List;
-
-import org.apache.openmeetings.db.dao.user.UserDao;
-import org.apache.openmeetings.db.entity.user.User;
-import org.apache.openmeetings.test.AbstractJUnitDefaults;
-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/test/calendar/TestGetAppointment.java
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/test/java/org/apache/openmeetings/test/calendar/TestGetAppointment.java b/openmeetings-web/src/test/java/org/apache/openmeetings/test/calendar/TestGetAppointment.java
deleted file mode 100644
index 2df1894..0000000
--- a/openmeetings-web/src/test/java/org/apache/openmeetings/test/calendar/TestGetAppointment.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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.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.db.dao.calendar.AppointmentDao;
-import org.apache.openmeetings.db.entity.calendar.Appointment;
-import org.apache.openmeetings.test.AbstractJUnitDefaults;
-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/test/calendar/TestOmCalendar.java
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/test/java/org/apache/openmeetings/test/calendar/TestOmCalendar.java b/openmeetings-web/src/test/java/org/apache/openmeetings/test/calendar/TestOmCalendar.java
deleted file mode 100644
index 5154bea..0000000
--- a/openmeetings-web/src/test/java/org/apache/openmeetings/test/calendar/TestOmCalendar.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * 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.calendar;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-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.apache.openmeetings.test.AbstractJUnitDefaults;
-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/test/calendar/TestSendIcalMessage.java
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/test/java/org/apache/openmeetings/test/calendar/TestSendIcalMessage.java b/openmeetings-web/src/test/java/org/apache/openmeetings/test/calendar/TestSendIcalMessage.java
deleted file mode 100644
index 45cd2ce..0000000
--- a/openmeetings-web/src/test/java/org/apache/openmeetings/test/calendar/TestSendIcalMessage.java
+++ /dev/null
@@ -1,235 +0,0 @@
-/*
- * 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.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.core.mail.MailHandler;
-import org.apache.openmeetings.test.AbstractJUnitDefaults;
-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/test/config/TestConfig.java
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/test/java/org/apache/openmeetings/test/config/TestConfig.java b/openmeetings-web/src/test/java/org/apache/openmeetings/test/config/TestConfig.java
deleted file mode 100644
index 3b98927..0000000
--- a/openmeetings-web/src/test/java/org/apache/openmeetings/test/config/TestConfig.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * 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.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.db.dao.basic.ConfigurationDao;
-import org.apache.openmeetings.db.entity.basic.Configuration;
-import org.apache.openmeetings.test.AbstractJUnitDefaults;
-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/test/core/file/TestFileProcessor.java
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/test/java/org/apache/openmeetings/test/core/file/TestFileProcessor.java b/openmeetings-web/src/test/java/org/apache/openmeetings/test/core/file/TestFileProcessor.java
deleted file mode 100644
index 82ca41a..0000000
--- a/openmeetings-web/src/test/java/org/apache/openmeetings/test/core/file/TestFileProcessor.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * 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.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.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.test.AbstractJUnitDefaults;
-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());
- }
- }
- }
-}