Index: lams_tool_notebook/.classpath
===================================================================
diff -u -r406cdd685f03fa39a0ea0c85bde60f7b268bc05d -r94978257a4e34f04f7997f60558db2762811c72b
--- lams_tool_notebook/.classpath (.../.classpath) (revision 406cdd685f03fa39a0ea0c85bde60f7b268bc05d)
+++ lams_tool_notebook/.classpath (.../.classpath) (revision 94978257a4e34f04f7997f60558db2762811c72b)
@@ -1,6 +1,7 @@
+
@@ -11,5 +12,10 @@
+
+
+
+
+
Index: lams_tool_notebook/lib/flash-selenium.jar
===================================================================
diff -u
Binary files differ
Index: lams_tool_notebook/lib/flex-ui-selenium-0.1.1.jar
===================================================================
diff -u
Binary files differ
Index: lams_tool_notebook/lib/selenium-java-client-driver-sources.jar
===================================================================
diff -u
Binary files differ
Index: lams_tool_notebook/lib/selenium-java-client-driver-test-sources.jar
===================================================================
diff -u
Binary files differ
Index: lams_tool_notebook/lib/selenium-java-client-driver-tests.jar
===================================================================
diff -u
Binary files differ
Index: lams_tool_notebook/lib/selenium-java-client-driver.jar
===================================================================
diff -u
Binary files differ
Index: lams_tool_notebook/lib/selenium-server-sources.jar
===================================================================
diff -u
Binary files differ
Index: lams_tool_notebook/lib/selenium-server.jar
===================================================================
diff -u
Binary files differ
Index: lams_tool_notebook/test/java/org/lamsfoundation/lams/tool/notebook/core/DefaultSeleniumFlex.java
===================================================================
diff -u
--- lams_tool_notebook/test/java/org/lamsfoundation/lams/tool/notebook/core/DefaultSeleniumFlex.java (revision 0)
+++ lams_tool_notebook/test/java/org/lamsfoundation/lams/tool/notebook/core/DefaultSeleniumFlex.java (revision 94978257a4e34f04f7997f60558db2762811c72b)
@@ -0,0 +1,182 @@
+
+/*
+ * License
+ *
+ * This file is part of The SeleniumFlex-API.
+ *
+ * The SeleniumFlex-API is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of
+ * the License, or any later version.
+ *
+ * The SeleniumFlex-API is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with The SeleniumFlex-API.
+ * If not, see http://www.gnu.org/licenses/
+ *
+ */
+
+package org.lamsfoundation.lams.tool.notebook.core;
+
+import com.thoughtworks.selenium.DefaultSelenium;
+import com.thoughtworks.selenium.HttpCommandProcessor;
+import com.thoughtworks.selenium.SeleniumException;
+
+
+public class DefaultSeleniumFlex extends DefaultSelenium {
+
+ public DefaultSeleniumFlex(HttpCommandProcessor proc) {
+ super(proc);
+ }
+
+ protected void handleException(SeleniumException e, String command, String target, String args) {
+ System.out.println(e.getMessage());
+ System.out.println("Failed command : " + command + "(" + target + ", " + args +")");
+ }
+
+ protected String executeCommand(String command, String target, String args) throws Exception {
+ String retval = "";
+ try {
+ retval = this.commandProcessor.doCommand(command, new String[] { target, args });
+ } catch (SeleniumException e) {
+ handleException(e, command, target, args);
+ throw e;
+ }
+ return retval;
+ }
+
+ public String getFlexSelectedItemAtIndex(String target, String args) throws Exception { return executeCommand("getFlexSelectedItemAtIndex", target, args).replace("OK,", ""); }
+ public String getFlexSelectedItemAtIndex(String target) throws Exception { return executeCommand("getFlexSelectedItemAtIndex", target, "").replace("OK,", ""); }
+ public String getFlexNumSelectedItems(String target, String args) throws Exception { return executeCommand("getFlexNumSelectedItems", target, args).replace("OK,", ""); }
+ public String getFlexNumSelectedItems(String target) throws Exception { return executeCommand("getFlexNumSelectedItems", target, "").replace("OK,", ""); }
+ public String getFlexVisible(String target, String args) throws Exception { return executeCommand("getFlexVisible", target, args).replace("OK,", ""); }
+ public String getFlexVisible(String target) throws Exception { return executeCommand("getFlexVisible", target, "").replace("OK,", ""); }
+ public String getFlexTextPresent(String target, String args) throws Exception { return executeCommand("getFlexTextPresent", target, args).replace("OK,", ""); }
+ public String getFlexTextPresent(String target) throws Exception { return executeCommand("getFlexTextPresent", target, "").replace("OK,", ""); }
+ public String getFlexText(String target, String args) throws Exception { return executeCommand("getFlexText", target, args).replace("OK,", ""); }
+ public String getFlexText(String target) throws Exception { return executeCommand("getFlexText", target, "").replace("OK,", ""); }
+ public String getFlexStepper(String target, String args) throws Exception { return executeCommand("getFlexStepper", target, args).replace("OK,", ""); }
+ public String getFlexStepper(String target) throws Exception { return executeCommand("getFlexStepper", target, "").replace("OK,", ""); }
+ public String getFlexSelectionIndex(String target, String args) throws Exception { return executeCommand("getFlexSelectionIndex", target, args).replace("OK,", ""); }
+ public String getFlexSelectionIndex(String target) throws Exception { return executeCommand("getFlexSelectionIndex", target, "").replace("OK,", ""); }
+ public String getFlexSelection(String target, String args) throws Exception { return executeCommand("getFlexSelection", target, args).replace("OK,", ""); }
+ public String getFlexSelection(String target) throws Exception { return executeCommand("getFlexSelection", target, "").replace("OK,", ""); }
+ public String getFlexRadioButton(String target, String args) throws Exception { return executeCommand("getFlexRadioButton", target, args).replace("OK,", ""); }
+ public String getFlexRadioButton(String target) throws Exception { return executeCommand("getFlexRadioButton", target, "").replace("OK,", ""); }
+ public String getFlexProperty(String target, String args) throws Exception { return executeCommand("getFlexProperty", target, args).replace("OK,", ""); }
+ public String getFlexProperty(String target) throws Exception { return executeCommand("getFlexProperty", target, "").replace("OK,", ""); }
+ public String getFlexParseInt(String target, String args) throws Exception { return executeCommand("getFlexParseInt", target, args).replace("OK,", ""); }
+ public String getFlexParseInt(String target) throws Exception { return executeCommand("getFlexParseInt", target, "").replace("OK,", ""); }
+ public String getFlexNumeric(String target, String args) throws Exception { return executeCommand("getFlexNumeric", target, args).replace("OK,", ""); }
+ public String getFlexNumeric(String target) throws Exception { return executeCommand("getFlexNumeric", target, "").replace("OK,", ""); }
+ public String getFlexGlobalPosition(String target, String args) throws Exception { return executeCommand("getFlexGlobalPosition", target, args).replace("OK,", ""); }
+ public String getFlexGlobalPosition(String target) throws Exception { return executeCommand("getFlexGlobalPosition", target, "").replace("OK,", ""); }
+ public String getFlexExists(String target, String args) throws Exception { return executeCommand("getFlexExists", target, args).replace("OK,", ""); }
+ public String getFlexExists(String target) throws Exception { return this.commandProcessor.doCommand("getFlexExists", new String[] { target, }); }
+ public String getFlexErrorString(String target, String args) throws Exception { return executeCommand("getFlexErrorString", target, args).replace("OK,", ""); }
+ public String getFlexErrorString(String target) throws Exception { return executeCommand("getFlexErrorString", target, "").replace("OK,", ""); }
+ public String getFlexEnabled(String target, String args) throws Exception { return executeCommand("getFlexEnabled", target, args).replace("OK,", ""); }
+ public String getFlexEnabled(String target) throws Exception { return executeCommand("getFlexEnabled", target, "").replace("OK,", ""); }
+ public String getFlexDate(String target, String args) throws Exception { return executeCommand("getFlexDate", target, args).replace("OK,", ""); }
+ public String getFlexDate(String target) throws Exception { return executeCommand("getFlexDate", target, "").replace("OK,", ""); }
+ public String getFlexDataGridUIComponentLabel(String target, String args) throws Exception { return executeCommand("getFlexDataGridUIComponentLabel", target, args).replace("OK,", ""); }
+ public String getFlexDataGridUIComponentLabel(String target) throws Exception { return executeCommand("getFlexDataGridUIComponentLabel", target, "").replace("OK,", ""); }
+ public String getFlexDataGridRowIndexForFieldValue(String target, String args) throws Exception { return executeCommand("getFlexDataGridRowIndexForFieldValue", target, args).replace("OK,", ""); }
+ public String getFlexDataGridRowIndexForFieldValue(String target) throws Exception { return executeCommand("getFlexDataGridRowIndexForFieldValue", target, "").replace("OK,", ""); }
+ public String getFlexDataGridRowCount(String target, String args) throws Exception { return executeCommand("getFlexDataGridRowCount", target, args).replace("OK,", ""); }
+ public String getFlexDataGridRowCount(String target) throws Exception { return executeCommand("getFlexDataGridRowCount", target, "").replace("OK,", ""); }
+ public String getFlexDataGridFieldValueForGridRow(String target, String args) throws Exception { return executeCommand("getFlexDataGridFieldValueForGridRow", target, args).replace("OK,", ""); }
+ public String getFlexDataGridFieldValueForGridRow(String target) throws Exception { return executeCommand("getFlexDataGridFieldValueForGridRow", target, "").replace("OK,", ""); }
+ public String getFlexDataGridCellText(String target, String args) throws Exception { return executeCommand("getFlexDataGridCellText", target, args).replace("OK,", ""); }
+ public String getFlexDataGridCellText(String target) throws Exception { return executeCommand("getFlexDataGridCellText", target, "").replace("OK,", ""); }
+ public String getFlexDataGridCell(String target, String args) throws Exception { return executeCommand("getFlexDataGridCell", target, args).replace("OK,", ""); }
+ public String getFlexDataGridCell(String target) throws Exception { return executeCommand("getFlexDataGridCell", target, "").replace("OK,", ""); }
+ public String getFlexComponentInfo(String target, String args) throws Exception { return executeCommand("getFlexComponentInfo", target, args).replace("OK,", ""); }
+ public String getFlexComponentInfo(String target) throws Exception { return executeCommand("getFlexComponentInfo", target, "").replace("OK,", ""); }
+ public String getFlexComboContainsLabel(String target, String args) throws Exception { return executeCommand("getFlexComboContainsLabel", target, args).replace("OK,", ""); }
+ public String getFlexComboContainsLabel(String target) throws Exception { return executeCommand("getFlexComboContainsLabel", target, "").replace("OK,", ""); }
+ public String getFlexCheckBoxChecked(String target, String args) throws Exception { return executeCommand("getFlexCheckBoxChecked", target, args).replace("OK,", ""); }
+ public String getFlexCheckBoxChecked(String target) throws Exception { return executeCommand("getFlexCheckBoxChecked", target, "").replace("OK,", ""); }
+ public String getFlexAlertTextPresent(String target, String args) throws Exception { return executeCommand("getFlexAlertTextPresent", target, args).replace("OK,", ""); }
+ public String getFlexAlertTextPresent(String target) throws Exception { return executeCommand("getFlexAlertTextPresent", target, "").replace("OK,", ""); }
+ public String getFlexAlertText(String target, String args) throws Exception { return executeCommand("getFlexAlertText", target, args).replace("OK,", ""); }
+ public String getFlexAlertText(String target) throws Exception { return executeCommand("getFlexAlertText", target, "").replace("OK,", ""); }
+ public String getFlexAlertPresent(String target, String args) throws Exception { return executeCommand("getFlexAlertPresent", target, args).replace("OK,", ""); }
+ public String getFlexAlertPresent(String target) throws Exception { return executeCommand("getFlexAlertPresent", target, "").replace("OK,", ""); }
+ public String getFlexASProperty(String target, String args) throws Exception { return executeCommand("getFlexASProperty", target, args).replace("OK,", ""); }
+ public String getFlexASProperty(String target) throws Exception { return executeCommand("getFlexASProperty", target, "").replace("OK,", ""); }
+ public String getDataGridUIComponentLabel(String target, String args) throws Exception { return executeCommand("getDataGridUIComponentLabel", target, args).replace("OK,", ""); }
+ public String getDataGridUIComponentLabel(String target) throws Exception { return executeCommand("getDataGridUIComponentLabel", target, "").replace("OK,", ""); }
+ public String getDataGridCellText(String target, String args) throws Exception { return executeCommand("getDataGridCellText", target, args).replace("OK,", ""); }
+ public String getDataGridCellText(String target) throws Exception { return executeCommand("getDataGridCellText", target, "").replace("OK,", ""); }
+ public void doRefreshIDToolTips(String target, String args) throws Exception { executeCommand("doRefreshIDToolTips", target, args); }
+ public void doRefreshIDToolTips(String target) throws Exception { executeCommand("doRefreshIDToolTips", target, ""); }
+ public void flexWaitForElementVisible(String target, String args) throws Exception { executeCommand("flexWaitForElementVisible", target, args); }
+ public void flexWaitForElementVisible(String target) throws Exception { executeCommand("flexWaitForElementVisible", target, ""); }
+ public void flexWaitForElement(String target, String args) throws Exception { executeCommand("flexWaitForElement", target, args); }
+ public void flexWaitForElement(String target) throws Exception { executeCommand("flexWaitForElement", target, ""); }
+ public void flexTypeAppend(String target, String args) throws Exception { executeCommand("flexTypeAppend", target, args); }
+ public void flexTypeAppend(String target) throws Exception { executeCommand("flexTypeAppend", target, ""); }
+ public void flexType(String target, String args) throws Exception { executeCommand("flexType", target, args); }
+ public void flexType(String target) throws Exception { executeCommand("flexType", target, ""); }
+ public void flexStepper(String target, String args) throws Exception { executeCommand("flexStepper", target, args); }
+ public void flexStepper(String target) throws Exception { executeCommand("flexStepper", target, ""); }
+ public void flexSetFocus(String target, String args) throws Exception { executeCommand("flexSetFocus", target, args); }
+ public void flexSetFocus(String target) throws Exception { executeCommand("flexSetFocus", target, ""); }
+ public void flexSetDataGridCell(String target, String args) throws Exception { executeCommand("flexSetDataGridCell", target, args); }
+ public void flexSetDataGridCell(String target) throws Exception { executeCommand("flexSetDataGridCell", target, ""); }
+ public void flexSelectMatchingOnField(String target, String args) throws Exception { executeCommand("flexSelectMatchingOnField", target, args); }
+ public void flexSelectMatchingOnField(String target) throws Exception { executeCommand("flexSelectMatchingOnField", target, ""); }
+ public void flexSelectIndex(String target, String args) throws Exception { executeCommand("flexSelectIndex", target, args); }
+ public void flexSelectIndex(String target) throws Exception { executeCommand("flexSelectIndex", target, ""); }
+ public void flexSelectComboByLabel(String target, String args) throws Exception { executeCommand("flexSelectComboByLabel", target, args); }
+ public void flexSelectComboByLabel(String target) throws Exception { executeCommand("flexSelectComboByLabel", target, ""); }
+ public void flexSelect(String target, String args) throws Exception { executeCommand("flexSelect", target, args); }
+ public void flexSelect(String target) throws Exception { executeCommand("flexSelect", target, ""); }
+ public void flexRefreshIDToolTips(String target, String args) throws Exception { executeCommand("flexRefreshIDToolTips", target, args); }
+ public void flexRefreshIDToolTips(String target) throws Exception { executeCommand("flexRefreshIDToolTips", target, ""); }
+ public void flexRadioButton(String target, String args) throws Exception { executeCommand("flexRadioButton", target, args); }
+ public void flexRadioButton(String target) throws Exception { executeCommand("flexRadioButton", target, ""); }
+ public void flexProperty(String target, String args) throws Exception { executeCommand("flexProperty", target, args); }
+ public void flexProperty(String target) throws Exception { executeCommand("flexProperty", target, ""); }
+ public void flexMouseUp(String target, String args) throws Exception { executeCommand("flexMouseUp", target, args); }
+ public void flexMouseUp(String target) throws Exception { executeCommand("flexMouseUp", target, ""); }
+ public void flexMouseRollOver(String target, String args) throws Exception { executeCommand("flexMouseRollOver", target, args); }
+ public void flexMouseRollOver(String target) throws Exception { executeCommand("flexMouseRollOver", target, ""); }
+ public void flexMouseRollOut(String target, String args) throws Exception { executeCommand("flexMouseRollOut", target, args); }
+ public void flexMouseRollOut(String target) throws Exception { executeCommand("flexMouseRollOut", target, ""); }
+ public void flexMouseOver(String target, String args) throws Exception { executeCommand("flexMouseOver", target, args); }
+ public void flexMouseOver(String target) throws Exception { executeCommand("flexMouseOver", target, ""); }
+ public void flexMouseMove(String target, String args) throws Exception { executeCommand("flexMouseMove", target, args); }
+ public void flexMouseMove(String target) throws Exception { executeCommand("flexMouseMove", target, ""); }
+ public void flexMouseDown(String target, String args) throws Exception { executeCommand("flexMouseDown", target, args); }
+ public void flexMouseDown(String target) throws Exception { executeCommand("flexMouseDown", target, ""); }
+ public void flexDragTo(String target, String args) throws Exception { executeCommand("flexDragTo", target, args); }
+ public void flexDragTo(String target) throws Exception { executeCommand("flexDragTo", target, ""); }
+ public void flexDoubleClick(String target, String args) throws Exception { executeCommand("flexDoubleClick", target, args); }
+ public void flexDoubleClick(String target) throws Exception { executeCommand("flexDoubleClick", target, ""); }
+ public void flexDate(String target, String args) throws Exception { executeCommand("flexDate", target, args); }
+ public void flexDate(String target) throws Exception { executeCommand("flexDate", target, ""); }
+ public void flexClickMenuBarUIComponent(String target, String args) throws Exception { executeCommand("flexClickMenuBarUIComponent", target, args); }
+ public void flexClickMenuBarUIComponent(String target) throws Exception { executeCommand("flexClickMenuBarUIComponent", target, ""); }
+ public void flexClickDataGridUIComponent(String target, String args) throws Exception { executeCommand("flexClickDataGridUIComponent", target, args); }
+ public void flexClickDataGridUIComponent(String target) throws Exception { executeCommand("flexClickDataGridUIComponent", target, ""); }
+ public void flexClickDataGridItem(String target, String args) throws Exception { executeCommand("flexClickDataGridItem", target, args); }
+ public void flexClickDataGridItem(String target) throws Exception { executeCommand("flexClickDataGridItem", target, ""); }
+ public void flexClick(String target, String args) throws Exception { executeCommand("flexClick", target, args); }
+ public void flexClick(String target) throws Exception { executeCommand("flexClick", target, ""); }
+ public void flexCheckBox(String target, String args) throws Exception { executeCommand("flexCheckBox", target, args); }
+ public void flexCheckBox(String target) throws Exception { executeCommand("flexCheckBox", target, ""); }
+ public void flexAlertResponse(String target, String args) throws Exception { executeCommand("flexAlertResponse", target, args); }
+ public void flexAlertResponse(String target) throws Exception { executeCommand("flexAlertResponse", target, ""); }
+ public void flexAddSelectMatchingOnField(String target, String args) throws Exception { executeCommand("flexAddSelectMatchingOnField", target, args); }
+ public void flexAddSelectMatchingOnField(String target) throws Exception { executeCommand("flexAddSelectMatchingOnField", target, ""); }
+ public void flexAddSelectIndex(String target, String args) throws Exception { executeCommand("flexAddSelectIndex", target, args); }
+ public void flexAddSelectIndex(String target) throws Exception { executeCommand("flexAddSelectIndex", target, ""); }
+}
+
+
\ No newline at end of file
Index: lams_tool_notebook/test/java/org/lamsfoundation/lams/tool/notebook/core/NotebookDataAccessTestCase.java
===================================================================
diff -u
--- lams_tool_notebook/test/java/org/lamsfoundation/lams/tool/notebook/core/NotebookDataAccessTestCase.java (revision 0)
+++ lams_tool_notebook/test/java/org/lamsfoundation/lams/tool/notebook/core/NotebookDataAccessTestCase.java (revision 94978257a4e34f04f7997f60558db2762811c72b)
@@ -0,0 +1,368 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2.0
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/* $Id$ */
+package org.lamsfoundation.lams.tool.notebook.core;
+
+import java.util.Date;
+
+import org.lamsfoundation.lams.test.AbstractLamsTestCase;
+import org.lamsfoundation.lams.tool.dao.hibernate.ToolDAO;
+import org.lamsfoundation.lams.tool.notebook.dao.INotebookAttachmentDAO;
+import org.lamsfoundation.lams.tool.notebook.dao.INotebookDAO;
+import org.lamsfoundation.lams.tool.notebook.dao.INotebookSessionDAO;
+import org.lamsfoundation.lams.tool.notebook.dao.INotebookUserDAO;
+import org.lamsfoundation.lams.tool.notebook.model.Notebook;
+import org.lamsfoundation.lams.tool.notebook.model.NotebookSession;
+import org.lamsfoundation.lams.tool.notebook.util.NotebookConstants;
+
+/**
+ * @author Andrey Balan
+ */
+public class NotebookDataAccessTestCase extends AbstractLamsTestCase {
+
+ // ---------------------------------------------------------------------
+ // DAO instances for initializing data
+ // ---------------------------------------------------------------------
+ protected INotebookDAO notebookDAO = null;
+
+ protected INotebookSessionDAO notebookSessionDAO = null;
+
+ protected INotebookUserDAO notebookUserDAO = null;
+
+ protected INotebookAttachmentDAO notebookAttachmentDAO = null;
+
+// protected ILamsToolService toolService;
+ protected ToolDAO toolDAO;
+
+ // ---------------------------------------------------------------------
+ // Domain Object instances
+ // ---------------------------------------------------------------------
+ protected Notebook notebook;
+ // protected NoticeboardSession nbSession;
+ // protected NoticeboardUser nbUser;
+ // protected NoticeboardAttachment nbAttachment;
+
+ // ---------------------------------------------------------------------
+ // DATA USED FOR TESTING PURPOSES ONLY
+ // ---------------------------------------------------------------------
+
+ protected final long ONE_DAY = 60 * 60 * 1000 * 24;
+
+ protected final Long TEST_NB_ID = new Long(1500);
+ protected final Long TEST_COPYNB_ID = new Long(3500);
+
+ protected final String TEST_TITLE = "Test Title";
+ protected final String TEST_CONTENT = "Welcome! We hope you enjoy the activities that are set out.";
+ protected final String TEST_ONLINE_INSTRUCTIONS = "Put your online instructions here";
+ protected final String TEST_OFFLINE_INSTRUCTIONS = "Put your offline instructions here";
+ protected final boolean TEST_DEFINE_LATER = false;
+ protected final boolean TEST_REFLECT_ON_ACTIVITY = false;
+ protected final String TEST_REFLECT_INSTRUCTIONS = "Put your reflections instructions here";
+ protected final boolean TEST_FORCE_OFFLINE = false;
+ protected final boolean TEST_CONTENT_IN_USE = false;
+ protected final Date TEST_DATE_CREATED = new Date(System.currentTimeMillis());
+ protected final Date TEST_DATE_UPDATED = new Date();
+ protected final Long TEST_CREATOR_USER_ID = new Long(1300);
+
+ protected final Long TEST_SESSION_ID = new Long(1400);
+ protected final String TEST_SESSION_NAME = "Session 1400";
+ protected final Date TEST_SESSION_START_DATE = new Date(System.currentTimeMillis());
+ protected final Date TEST_SESSION_END_DATE = new Date(System.currentTimeMillis() + ONE_DAY);
+ protected final Integer TEST_SESSION_STATUS = NotebookConstants.SESSION_NOT_STARTED;
+
+ protected final Long TEST_USER_ID = new Long(1600);
+ protected final String TEST_USERNAME = "testUsername";
+ protected final String TEST_FULLNAME = "Test User Fullname";
+ // protected final String TEST_USER_STATUS = NoticeboardUser.INCOMPLETE;
+
+ protected final String TEST_FILENAME = "testFilename";
+ protected final boolean TEST_IS_ONLINE_FILE = true;
+ protected final Long TEST_UUID = new Long(2002);
+
+ // ---------------------------------------------------------------------
+ // DEFAULT DATA INSERTED BY BUILD-DB ANT TASK
+ // ---------------------------------------------------------------------
+ protected final Long DEFAULT_CONTENT_ID = new Long(2500);
+ protected final String DEFAULT_TITLE = "Welcome";
+ protected final String DEFAULT_CONTENT = "Welcome to these activities";
+ protected final String DEFAULT_ONLINE_INSTRUCTIONS = "Enter the online instructions here";
+ protected final String DEFAULT_OFFLINE_INSTRUCTIONS = "Enter the offline instructions here";
+ protected final boolean DEFAULT_DEFINE_LATER = false;
+ protected final boolean DEFAULT_FORCE_OFFLINE = false;
+ protected final boolean DEFAULT_CONTENT_IN_USE = false;
+ protected final Long DEFAULT_CREATOR_USER_ID = new Long(2300);
+ protected final Long DEFAULT_SESSION_ID = new Long(2400);
+ protected final Integer DEFAULT_SESSION_STATUS = NotebookConstants.SESSION_IN_PROGRESS;
+ protected final Long DEFAULT_USER_ID = new Long(2600);
+ protected final String DEFAULT_USERNAME = "test";
+ protected final String DEFAULT_FULLNAME = "test";
+
+ // protected final String DEFAULT_USER_STATUS = NotebookUser.INCOMPLETE;
+
+ /** Default Constructor */
+ public NotebookDataAccessTestCase(String name) {
+ super(name);
+ }
+
+ // ---------------------------------------------------------------------
+ // Inherited Methods
+ // ---------------------------------------------------------------------
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ toolDAO = (ToolDAO) this.context.getBean("toolDAO");
+ toolDAO.getToolBySignature("lanb10");
+ int a = 122;
+ // notebookDAO = (NotebookDAO) this.context.getBean("notebookDAO");
+ // notebookSessionDAO= (NotebookSessionDAO) this.context.getBean("notebookSessionDAO");
+ // notebookUserDAO = (NotebookUserDAO) this.context.getBean("notebookUserDAO");
+ // notebookAttachmentDAO = (NotebookAttachmentDAO)this.context.getBean("notebookAttachmentDAO");
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /** Define the context files. Overrides method in AbstractLamsTestCase */
+ protected String[] getContextConfigLocation() {
+ return new String[] {
+ // "org/lamsfoundation/lams/localApplicationContext.xml"};//,
+ // "org/lamsfoundation/lams/lesson/lessonApplicationContext.xml",
+ // "org/lamsfoundation/lams/toolApplicationContext.xml",
+ // "org/lamsfoundation/lams/learning/learningApplicationContext.xml",
+ // "org/lamsfoundation/lams/tool/notebook/testApplicationContext.xml"};
+
+ "org/lamsfoundation/lams/localApplicationContext.xml",
+ "org/lamsfoundation/lams/lesson/lessonApplicationContext.xml",
+ "org/lamsfoundation/lams/toolApplicationContext.xml",
+
+ //"org/lamsfoundation/lams/contentrepository/applicationContext.xml",
+
+ "org/lamsfoundation/lams/learning/learningApplicationContext.xml",
+ //"org/lamsfoundation/lams/tool/notebook/testApplicationContext.xml"
+ };
+
+ }
+
+ // protected String[] getContextConfigLocation() {
+ // return new String[] {"org/lamsfoundation/lams/localApplicationContext.xml",
+ // "org/lamsfoundation/lams/tool/sbmt/submitFilesApplicationContext.xml",
+ // "org/lamsfoundation/lams/contentrepository/applicationContext.xml",
+ // "org/lamsfoundation/lams/lesson/lessonApplicationContext.xml",
+ // "org/lamsfoundation/lams/learning/learningApplicationContext.xml",
+ // "org/lamsfoundation/lams/toolApplicationContext.xml"};
+ // }
+
+ /** Define the sessionFactory bean name located in testApplication.xml. */
+ protected String getHibernateSessionFactoryName() {
+ return "notebookSessionFactory";
+ }
+
+ protected void initNbContentData() {
+ // notebook = new Notebook(TEST_NB_ID,
+ // TEST_TITLE,
+ // TEST_CONTENT,
+ // TEST_ONLINE_INSTRUCTIONS,
+ // TEST_OFFLINE_INSTRUCTIONS,
+ // TEST_DEFINE_LATER,
+ // TEST_FORCE_OFFLINE,
+ // TEST_REFLECT_ON_ACTIVITY,
+ // TEST_REFLECT_INSTRUCTIONS,
+ // TEST_CONTENT_IN_USE,
+ // TEST_CREATOR_USER_ID,
+ // TEST_DATE_CREATED,
+ // TEST_DATE_UPDATED);
+ //
+ // notebookDAO.saveOrUpdate(notebook);
+
+ }
+
+ // protected void cleanNbContentData(Long contentId)
+ // {
+ // noticeboardDAO.removeNoticeboard(contentId);
+ // //it correspondingly removes all the sessions and users along with it.
+ // }
+ //
+ //
+ // protected Long getTestNoticeboardId()
+ // {
+ // return this.TEST_NB_ID;
+ // }
+ //
+ // protected void initNbSessionContent()
+ // {
+ //
+ // NoticeboardContent nb = noticeboardDAO.findNbContentById(TEST_NB_ID);
+ //
+ // nbSession = new NoticeboardSession(TEST_SESSION_ID,
+ // TEST_SESSION_NAME,
+ // nb,
+ // TEST_SESSION_START_DATE,
+ // TEST_SESSION_END_DATE,
+ // TEST_SESSION_STATUS);
+ // nbSessionDAO.saveNbSession(nbSession);
+ //
+ // //associate the session with the content
+ // nb.getNbSessions().add(nbSession);
+ //
+ // }
+
+ protected void initNbUserData() {
+ NotebookSession ns = notebookSessionDAO.getBySessionId(TEST_SESSION_ID);
+
+ // NotebookUser user = new NotebookUser(TEST_USER_ID,
+ // ns,
+ // TEST_USERNAME,
+ // TEST_FULLNAME,
+ // TEST_USER_STATUS);
+ //
+ // notebookUserDAO.saveNbUser(user);
+ //
+ // ns.getNbUsers().add(user);
+ }
+
+ // /* TODO: have to upload attachment to repository */
+ // protected void initNbAttachmentData()
+ // {
+ // NoticeboardAttachment attachment = new NoticeboardAttachment();
+ // NoticeboardContent nb = noticeboardDAO.findNbContentById(TEST_NB_ID);
+ //
+ // attachment.setFilename(TEST_FILENAME);
+ // attachment.setOnlineFile(TEST_IS_ONLINE_FILE);
+ // attachment.setNbContent(nbContent);
+ // attachment.setUuid(TEST_UUID);
+ //
+ // attachmentDAO.saveAttachment(attachment);
+ //
+ // nb.getNbAttachments().add(attachment);
+ // }
+
+ protected void initAllData() {
+ initNbContentData();
+ // initNbSessionContent();
+ initNbUserData();
+ }
+
+ // protected void restoreDefaultContent(Long defaultContentId)
+ // {
+ // nbContent = new NoticeboardContent(defaultContentId,
+ // DEFAULT_TITLE,
+ // DEFAULT_CONTENT,
+ // DEFAULT_ONLINE_INSTRUCTIONS,
+ // DEFAULT_OFFLINE_INSTRUCTIONS,
+ // DEFAULT_DEFINE_LATER,
+ // DEFAULT_FORCE_OFFLINE,
+ // DEFAULT_CONTENT_IN_USE,
+ // null,
+ // DEFAULT_CONTENT_IN_USE,
+ // TEST_CREATOR_USER_ID,
+ // TEST_DATE_CREATED,
+ // null);
+ //
+ // noticeboardDAO.saveNbContent(nbContent);
+ //
+ // }
+
+ // ===========================
+ // Helper Methods
+ // ===========================
+
+ // protected void assertNbSessionIsNull(Long id)
+ // {
+ // NoticeboardSession nbSession = nbSessionDAO.findNbSessionById(id);
+ // assertNull(nbSession);
+ // }
+ //
+ // protected void assertNbContentIsNull(Long id)
+ // {
+ // NoticeboardContent nbContent = noticeboardDAO.findNbContentById(id);
+ // assertNull(nbContent);
+ // }
+ //
+ protected void assertContentEqualsTestData(Notebook content) {
+ assertEquals(content.getTitle(), TEST_TITLE);
+ assertEquals(content.getOnlineInstructions(), TEST_ONLINE_INSTRUCTIONS);
+ assertEquals(content.getOfflineInstructions(), TEST_OFFLINE_INSTRUCTIONS);
+ assertEquals(content.isDefineLater(), TEST_DEFINE_LATER);
+ }
+
+ // protected void assertContentEqualsDefaultData(NoticeboardContent content)
+ // {
+ //
+ // assertEquals(content.getTitle(), DEFAULT_TITLE);
+ // assertEquals(content.getContent(), DEFAULT_CONTENT);
+ // assertEquals(content.getOnlineInstructions(), DEFAULT_ONLINE_INSTRUCTIONS);
+ // assertEquals(content.getOfflineInstructions(), DEFAULT_OFFLINE_INSTRUCTIONS);
+ // assertEquals(content.isDefineLater(), DEFAULT_DEFINE_LATER);
+ // assertEquals(content.isForceOffline(), DEFAULT_FORCE_OFFLINE);
+ // }
+ //
+ // protected void assertEqualsForSessionContent(NoticeboardSession ns)
+ // {
+ // assertEquals("Validate session id ",ns.getNbSessionId(), TEST_SESSION_ID);
+ // assertEquals("Validate content id ",ns.getNbContent().getNbContentId(), TEST_NB_ID);
+ // assertEquals("Validate session start date", ns.getSessionStartDate(), TEST_SESSION_START_DATE);
+ // assertEquals("Validate session end date", ns.getSessionEndDate(), TEST_SESSION_END_DATE);
+ // assertEquals("Validate session status", ns.getSessionStatus(), TEST_SESSION_STATUS);
+ // }
+ //
+ // protected void assertSessionObjectIsNull(Long sessionId)
+ // {
+ // NoticeboardSession nsObject = nbSessionDAO.findNbSessionById(sessionId);
+ // assertNull(nsObject);
+ // }
+ //
+ // protected void assertEqualsForNbUser(NoticeboardUser user)
+ // {
+ // assertEquals("Validate user id",user.getUserId(), TEST_USER_ID);
+ // assertEquals("Validate username",user.getUsername(), TEST_USERNAME);
+ // assertEquals("Validate fullname", user.getFullname(), TEST_FULLNAME);
+ // assertEquals("Validate user status", user.getUserStatus(), TEST_USER_STATUS);
+ // assertEquals("Validate session id",user.getNbSession().getNbSessionId(), TEST_SESSION_ID);
+ //
+ // }
+ //
+ // protected void assertEqualsForDefaultNbUser(NoticeboardUser user)
+ // {
+ // assertEquals("Validate user id",user.getUserId(), DEFAULT_USER_ID);
+ // assertEquals("Validate username",user.getUsername(), DEFAULT_USERNAME);
+ // assertEquals("Validate fullname", user.getFullname(), DEFAULT_FULLNAME);
+ // assertEquals("Validate user status", user.getUserStatus(), DEFAULT_USER_STATUS);
+ // assertEquals("Validate session id",user.getNbSession().getNbSessionId(), DEFAULT_SESSION_ID);
+ //
+ // }
+ //
+ // protected void assertUserObjectIsNull(Long userId)
+ // {
+ // NoticeboardUser user = nbUserDAO.getNbUser(userId, TEST_SESSION_ID);
+ // assertNull(user);
+ // }
+ //
+ // protected void assertAttachmentData(NoticeboardAttachment attachment)
+ // {
+ // assertEquals("Validating the filename:", attachment.getFilename(), TEST_FILENAME);
+ // assertEquals("Validating whether it is an online file", attachment.isOnlineFile(), TEST_IS_ONLINE_FILE);
+ // assertEquals("Validating the tool content id", attachment.getNbContent().getNbContentId(), TEST_NB_ID);
+ // assertEquals("Validating the Uuid", attachment.getUuid(), TEST_UUID);
+ // }
+}
Index: lams_tool_notebook/test/java/org/lamsfoundation/lams/tool/notebook/core/SeleniumBaseTestCase.java
===================================================================
diff -u
--- lams_tool_notebook/test/java/org/lamsfoundation/lams/tool/notebook/core/SeleniumBaseTestCase.java (revision 0)
+++ lams_tool_notebook/test/java/org/lamsfoundation/lams/tool/notebook/core/SeleniumBaseTestCase.java (revision 94978257a4e34f04f7997f60558db2762811c72b)
@@ -0,0 +1,407 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2.0
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/* $Id$ */
+package org.lamsfoundation.lams.tool.notebook.core;
+
+import org.hibernate.HibernateException;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.lamsfoundation.lams.learningdesign.Activity;
+import org.lamsfoundation.lams.learningdesign.ToolActivity;
+import org.lamsfoundation.lams.learningdesign.dao.hibernate.ActivityDAO;
+import org.lamsfoundation.lams.lesson.Lesson;
+import org.lamsfoundation.lams.lesson.dao.hibernate.LessonDAO;
+import org.lamsfoundation.lams.tool.Tool;
+import org.lamsfoundation.lams.tool.dao.hibernate.ToolDAO;
+import org.lamsfoundation.lams.usermanagement.service.UserManagementService;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+import org.springframework.orm.hibernate3.SessionFactoryUtils;
+import org.springframework.orm.hibernate3.SessionHolder;
+import org.springframework.transaction.support.TransactionSynchronizationManager;
+
+import com.thoughtworks.selenium.HttpCommandProcessor;
+import com.thoughtworks.selenium.SeleneseTestCase;
+
+public class SeleniumBaseTestCase extends SeleneseTestCase {
+
+// protected FlexUISelenium flexUITester;
+// protected FlashSelenium flashApp;
+// protected DefaultSeleniumFlex defaultSeleniumFlex;
+
+ protected static int defaultActivityUIId = 1;
+
+ protected ApplicationContext context;
+
+ protected ToolDAO toolDAO;
+ protected ActivityDAO activityDAO;
+ protected UserManagementService userManagementService;
+ protected LessonDAO lessonDAO;
+
+
+ private static final String[] contextConfigLocation = new String[] {
+ // "org/lamsfoundation/lams/localApplicationContext.xml"};//,
+ // "org/lamsfoundation/lams/lesson/lessonApplicationContext.xml",
+ // "org/lamsfoundation/lams/toolApplicationContext.xml",
+ // "org/lamsfoundation/lams/learning/learningApplicationContext.xml",
+ // "org/lamsfoundation/lams/tool/notebook/testApplicationContext.xml"};
+ "org/lamsfoundation/lams/localCommonContext.xml",
+ "org/lamsfoundation/lams/lesson/lessonApplicationContext.xml",
+ "org/lamsfoundation/lams/toolApplicationContext.xml",
+ //"org/lamsfoundation/lams/contentrepository/applicationContext.xml",
+ //TODO we might gonna need this one
+ //"org/lamsfoundation/lams/learning/learningApplicationContext.xml",
+ //"org/lamsfoundation/lams/workspace/workspaceapplicationcontext.xml",
+// "org/lamsfoundation/lams/authoring/testAuthoringApplicationContext.xml",
+ //"org/lamsfoundation/lams/monitoring/monitoringapplicationcontext.xml",
+// "org/lamsfoundation/lams/tool/notebook/testApplicationContext.xml"
+ };
+
+ private static final String SERVER_HOST = "localhost";
+ private static final int SERVER_PORT = 5555;
+ private static final String BROWSER_START_COMMAND = "*firefox";
+ private static final String BROWSER_URL = "http://127.0.0.1:8080/lams/";
+
+ protected static final String SERVER_URL = "/lams/";
+ protected static final String USER_LOGIN = "mmm";
+ private static final String USER_PASSWORD = "mmm";
+
+ public void setUp() throws Exception {
+ context = new ClassPathXmlApplicationContext(contextConfigLocation);
+// initializeHibernateSession();
+
+ toolDAO = (ToolDAO) this.context.getBean("toolDAO");
+ activityDAO = (ActivityDAO) this.context.getBean("activityDAO");
+ userManagementService = (UserManagementService) this.context.getBean("userManagementService");
+ lessonDAO = (LessonDAO) this.context.getBean("lessonDAO");
+
+// selenium = new DefaultSelenium(SERVER_HOST, SERVER_PORT, BROWSER_START_COMMAND, BROWSER_URL);
+// selenium.start();
+
+
+// flashApp = new FlashSelenium(selenium, "clickcolors");
+ HttpCommandProcessor proc = new HttpCommandProcessor(SERVER_HOST, SERVER_PORT, BROWSER_START_COMMAND, BROWSER_URL);
+ selenium = new DefaultSeleniumFlex(proc);
+ selenium.start();
+ selenium.setSpeed("1000");
+
+// assertEquals(100, flashApp.PercentLoaded());
+// setUp("http://www.google.com/", "*firefox");
+// flexUITester = new FlexUISelenium(selenium, "compareSumFlexObjId");
+ }
+
+ /** checks for verification errors and stops the browser */
+ public void tearDown() throws Exception {
+ super.tearDown();
+// finalizeHibernateSession();
+ selenium.stop();
+ }
+
+ /** checks for verification errors and stops the browser */
+ public void loginToLams() throws Exception {
+ super.tearDown();
+ selenium.open(SERVER_URL);
+ selenium.type("j_username", USER_LOGIN);
+ selenium.type("j_password", USER_PASSWORD);
+ selenium.click("//p[@class='login-button']/a");
+ selenium.waitForPageToLoad("10000");
+ Thread.sleep(2000);
+ }
+
+ /** checks for verification errors and stops the browser */
+ public void openAuthoringCanvas() throws Exception {
+ selenium.click("//div[@id='header-my-courses']//div[@class='tab-middle-highlight']/a");
+ selenium.waitForPopUp("aWindow", "5000");
+// Thread.sleep(6000);
+ }
+
+
+ //TODO change this behaviour
+ private String toolContentID;
+ private String contentFolderID;
+
+ /** checks for verification errors and stops the browser */
+ public void openToolAuthoringWindow(String toolSignature) throws Exception {
+ loginToLams();
+ openAuthoringCanvas();
+
+ Integer userID = userManagementService.getUserByLogin(USER_LOGIN).getUserId();
+ String createUniqueContentFolderUrl = SERVER_URL + "authoring/author.do?method=createUniqueContentFolder&userID=" + userID;
+ final String createUniqueContentFolderId = "createUniqueContentFolderId";
+ selenium.openWindow(createUniqueContentFolderUrl, createUniqueContentFolderId);
+ selenium.waitForPopUp(createUniqueContentFolderId, "5000");
+ selenium.selectWindow(createUniqueContentFolderId);
+ String wddxPacket = selenium.getEval("this.browserbot.getDocument().getElementsByTagName('body')[0].innerHTML");
+ contentFolderID = this.extractFolderIDFromWDDXPacket(wddxPacket);
+ selenium.close();
+ selenium.selectWindow(null);
+
+ Tool tool = toolDAO.getToolBySignature(toolSignature);
+ String getToolContentUrl = SERVER_URL + "authoring/author.do?method=getToolContentID&toolID=" + tool.getToolId();
+ final String getToolContentId = "getToolContentId";
+ selenium.openWindow(getToolContentUrl, getToolContentId);
+ selenium.waitForPopUp(getToolContentId, "5000");
+ selenium.selectWindow(getToolContentId);
+ wddxPacket = selenium.getEval("this.browserbot.getDocument().getElementsByTagName('body')[0].innerHTML");
+ toolContentID = this.extractToolContentIDFromWDDXPacket(wddxPacket);
+ selenium.close();
+ selenium.selectWindow(null);
+
+ String openToolUrl = SERVER_URL + tool.getAuthorUrl() +
+ "?mode=author"
+ + "&toolContentID=" + toolContentID
+ + "&contentFolderID=" + contentFolderID;
+ final String openToolId = "openToolId";
+ selenium.openWindow(openToolUrl.toString(), openToolId);
+ selenium.waitForPopUp(openToolId, "5000");
+ selenium.selectWindow(openToolId);
+ }
+
+ /** checks for verification errors and stops the browser */
+ public void closeToolAuthoringWindow() throws Exception {
+ selenium.click("//span[@class='okIcon']");
+ selenium.waitForPageToLoad("30000");
+ selenium.click("//span[@class='close']");
+ selenium.selectWindow("aWindow");
+ }
+
+ /** checks for verification errors and stops the browser */
+ public void storeLearningDesign(String toolSignature, String newLearningDesignName) throws Exception {
+ closeToolAuthoringWindow();
+
+ // TemplateActivityByLibraryID(libraryID);
+ final String storeLearningDesignUrl = SERVER_URL + "servlet/authoring/storeLearningDesignDetails";
+ String designDetails = constructWddxDesign(toolSignature, newLearningDesignName);
+ selenium.runScript("var options = { " +
+ "method:\"post\", " +
+ "postBody:\"" + designDetails + "\" " +
+ "};" +
+ "new Ajax.Request(\"" + storeLearningDesignUrl + "\",options);");
+ selenium.close();
+ selenium.selectWindow(null);
+ }
+
+ /** checks for verification errors and stops the browser */
+ public void openToolMonitor(String toolSignature, String learningDesignName) throws Exception {
+ loginToLams();
+
+ String lessonIdStr = selenium.getEval("window.document.evaluate(\"//a[text()=' " + learningDesignName + "']/parent::*\", window.document, null, XPathResult.ANY_TYPE, null).iterateNext().id");
+ Long lessonId = Long.parseLong(lessonIdStr);
+ Lesson lesson = lessonDAO.getLesson(lessonId);
+ String contentFolderID = lesson.getLearningDesign().getContentFolderID();
+ Activity activity = lesson.getLearningDesign().getFirstActivity();
+ ;
+ ToolActivity toolActivity = (ToolActivity) activityDAO.getActivityByActivityId(activity.getActivityId());
+// userManagementService.get
+
+ selenium.click("//a[text()=' " + learningDesignName + "']/following-sibling::*[2]");
+ selenium.waitForPopUp("mWindow", "15000");
+
+ Tool tool = toolDAO.getToolBySignature(toolSignature);
+ String monitorUrl = SERVER_URL + tool.getMonitorUrl()
+ + "?toolContentID=" + toolActivity.getToolContentId() +
+ "&contentFolderID=" + contentFolderID;
+ final String monitorId = "monitorId";
+ selenium.openWindow(monitorUrl, monitorId);
+ selenium.waitForPopUp(monitorId, "5000");
+ selenium.selectWindow(monitorId);
+ }
+
+ /** checks for verification errors and stops the browser */
+ public void closeToolMonitor() throws Exception {
+ selenium.close();
+ selenium.selectWindow(null);
+ }
+
+ /**
+ * @throws HibernateException
+ */
+ protected void initializeHibernateSession() throws HibernateException
+ {
+ //hold the hibernate session
+ SessionFactory sessionFactory = (SessionFactory) this.context.getBean("notebookSessionFactory");
+ Session s = sessionFactory.openSession();
+ TransactionSynchronizationManager.bindResource(sessionFactory, new SessionHolder(s));
+ }
+ /**
+ * @throws HibernateException
+ */
+ protected void finalizeHibernateSession() throws HibernateException
+ {
+ //clean the hibernate session
+ SessionFactory sessionFactory = (SessionFactory)this.context.getBean("notebookSessionFactory");
+ SessionHolder holder = (SessionHolder)TransactionSynchronizationManager.getResource(sessionFactory);
+ if (holder != null) {
+ Session s = holder.getSession();
+ s.flush();
+ TransactionSynchronizationManager.unbindResource(sessionFactory);
+ SessionFactoryUtils.releaseSession(s, sessionFactory);
+ }
+ }
+
+
+
+
+ /**
+ * Given a WDDX packet in our normal format, gets the id number from within the <var
+ * name='messageValue'><number>num</number></var>
+ *
+ * @param wddxPacket
+ * @return id
+ */
+ private String extractFolderIDFromWDDXPacket(String wddxPacket) {
+ int indexMessageValue = wddxPacket.indexOf("");
+ assertTrue(" string not found", indexMessageValue > 0);
+ int endIndexMessageValue = wddxPacket.indexOf("", indexMessageValue);
+ return wddxPacket.substring(indexMessageValue + "".length(), endIndexMessageValue);
+ }
+
+ /**
+ * Given a WDDX packet in our normal format, gets the id number from within the <var
+ * name='messageValue'><number>num</number></var>
+ *
+ * @param wddxPacket
+ * @return id
+ */
+ private String extractToolContentIDFromWDDXPacket(String wddxPacket) {
+// Log.info("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2" + wddxPacket);
+ int indexMessageValue = wddxPacket.indexOf("");
+ assertTrue(wddxPacket + "!! string not found", indexMessageValue > 0);
+ int endIndexMessageValue = wddxPacket.indexOf(".0", indexMessageValue);
+ String idString = wddxPacket.substring(indexMessageValue + "".length(), endIndexMessageValue);
+ try {
+ Long.parseLong(idString);
+ return idString;
+ } catch (NumberFormatException e) {
+ fail("Unable to get id number from WDDX packet. Format exception. String was " + idString);
+ }
+ return null;
+ }
+
+ private String constructWddxDesign(String toolSignature, String newLearningDesignName) throws Exception {
+ Integer userID = userManagementService.getUserByLogin(USER_LOGIN).getUserId();
+ Tool tool = toolDAO.getToolBySignature(toolSignature);
+
+ ToolActivity templateActivity = null;
+ for (Object activityObject : activityDAO.getAllActivities()) {
+ if (activityObject instanceof ToolActivity) {
+ ToolActivity activity = (ToolActivity) activityObject;
+ if ((activity.getLearningDesign() == null) && activity.getTool().getToolId().equals(tool.getToolId())) {
+ templateActivity = activity;
+ }
+ }
+ }
+
+ String design =
+ "" +
+ "" +
+ "" +
+ "" +
+ "" +
+ "" +
+ "" +
+ "" +
+ "" +
+ "" +
+ "" +
+ "" +
+ "string_null_value" +
+ "string_null_value" +
+ "" + tool.getToolId() + "" +
+ "" + toolContentID + "" +
+ "" + tool.getToolSignature() + "" +
+ "" + tool.getToolDisplayName() + "" +
+ "" + tool.getHelpUrl() + "" +
+ "" + tool.getAuthorUrl() + "" +
+ "" +
+ "" + templateActivity.getGroupingSupportType() + "" +
+ "2009-6-12T1:24:50+3:0" +
+ "" +
+ "" +
+ "" +
+ "-111111" +
+ "-111111" +
+ "" + templateActivity.getLibraryActivityUiImage() + "" +
+ "124" +
+ "132" +
+ "" + templateActivity.getHelpText() + "" +
+ "" + templateActivity.getDescription() + "" +
+ "" + templateActivity.getTitle() + "" +
+ "" + templateActivity.getLearningLibrary().getLearningLibraryId() + "" +
+ ""+ (defaultActivityUIId++) +"" +
+ "" + templateActivity.getActivityCategoryID() + "" +
+ "" + templateActivity.getActivityId() + "" +
+ "" + templateActivity.getActivityTypeId() + "" +
+ "" +
+ "" +
+ "" +
+ "" + contentFolderID + "" +
+ "2009-6-24T22:45:24+3:0" +
+ //TODO may be we need provide real workspaceFolderID
+ "4" +
+ "1" +
+ "1" +
+ "" +
+ "" +
+ "" + userID + "" +
+ "" + newLearningDesignName + "" +
+ "-111111" +
+ "1" +
+ "" +
+ "" +
+ "";
+ return design;
+ }
+
+
+
+
+// /**
+// * Given a WDDX packet in our normal format, return the map object in the messageValue parameter. This should
+// * contain any returned ids.
+// *
+// * @param wddxPacket
+// * @return Map
+// */
+// protected String extractIdMapFromWDDXPacket(String wddxPacket) {
+//
+// Object obj = null;
+// try {
+// obj = WDDXProcessor.deserialize(wddxPacket);
+// } catch (WddxDeserializationException e1) {
+// fail("WddxDeserializationException " + e1.getMessage());
+// e1.printStackTrace();
+// }
+//// WDDXProcessor.convertToBoolean(table, key)
+//
+// Map map = (Map) obj;
+// Object uniqueContentFolderObj = map.get("createUniqueContentFolder");
+// assertNotNull("createUniqueContentFolder object found", uniqueContentFolderObj);
+// if (!String.class.isInstance(uniqueContentFolderObj)) {
+// fail("createUniqueContentFolder is not a String - try extractIdFromWDDXPacket(packet)");
+// }
+//
+// return (String) uniqueContentFolderObj;
+// }
+
+}
Index: lams_tool_notebook/test/java/org/lamsfoundation/lams/tool/notebook/core/SeleniumFlexTestCase.java
===================================================================
diff -u
--- lams_tool_notebook/test/java/org/lamsfoundation/lams/tool/notebook/core/SeleniumFlexTestCase.java (revision 0)
+++ lams_tool_notebook/test/java/org/lamsfoundation/lams/tool/notebook/core/SeleniumFlexTestCase.java (revision 94978257a4e34f04f7997f60558db2762811c72b)
@@ -0,0 +1,162 @@
+package org.lamsfoundation.lams.tool.notebook.core;
+
+
+import java.lang.reflect.Method;
+import java.util.Properties;
+
+import com.thoughtworks.selenium.HttpCommandProcessor;
+import com.thoughtworks.selenium.SeleneseTestCase;
+
+
+public class SeleniumFlexTestCase extends SeleneseTestCase {
+
+
+
+ private Properties testProperties;
+
+ private String testServer;
+ private int listnerPort;
+ private String browser;
+ private String host;
+ private String baseURL;
+
+
+ public void setUpTest()
+ {
+ testServer = testProperties.getProperty("seleniumServer.location");
+ listnerPort = Integer.parseInt(testProperties.getProperty("seleniumServer.listnerport"));
+ browser = "*" + testProperties.getProperty("seleniumServer.browser");
+ host = testProperties.getProperty("environment.webapp.host");
+ baseURL = host + testProperties.getProperty("environment.webapp.dir");
+ }
+
+ protected String getData(String property)
+ {
+ return testProperties.getProperty(property);
+ }
+
+ protected void setDataSource(Properties testProperties)
+ {
+ testProperties = this.testProperties;
+ }
+
+
+ protected DefaultSeleniumFlex getDefaultSeleniumFlex()
+ {
+ HttpCommandProcessor proc = new HttpCommandProcessor(testServer, listnerPort, browser, baseURL);
+ DefaultSeleniumFlex selenium = new DefaultSeleniumFlex(proc);
+
+ return selenium;
+ }
+
+ protected void waitForFlexExists(String objectID, int timeout, DefaultSeleniumFlex selenium) throws Exception
+ {
+ while(timeout > 0 && ! selenium.getFlexExists(objectID).equals("true")) {
+ Thread.sleep(1000);
+ timeout--;
+ }
+ if(timeout == 0){
+ throw new Exception("waitForFlexExists flex object:" + objectID + " Timed Out");
+ }
+ }
+
+ protected void waitForFlexVisible(String objectID, int timeout, DefaultSeleniumFlex selenium) throws Exception
+ {
+ while(timeout > 0 && ! selenium.getFlexVisible(objectID).equals("true")) {
+ Thread.sleep(1000);
+ timeout--;
+ }
+ if(timeout == 0){
+ throw new Exception("waitForFlexVisible flex object:" + objectID + " Timed Out");
+ }
+ }
+
+ protected void openModule(String module, DefaultSeleniumFlex selenium) throws Exception
+ {
+ // open a module and wait for it to complete loading
+ String coreBlank = testProperties.getProperty("environment.webapp.host") + "selenium-server/core/Blank.html";
+ if(selenium.getLocation().equals(coreBlank))
+ {
+ selenium.open(testProperties.getProperty("environment.webapp.page"));
+ // just buffer with a little time to stop the test from stepping on its own feet
+ Thread.sleep(3000);
+ waitForFlexExists("loadModCombo", 20, selenium);
+ selenium.flexSelectIndex("loadModCombo", module);
+ }
+ else
+ {
+ selenium.refresh();
+ Thread.sleep(3000);
+ waitForFlexExists("loadModCombo", 20, selenium);
+ selenium.flexSelectIndex("loadModCombo", module);
+ }
+ }
+
+ protected void completeCreditCard(DefaultSeleniumFlex selenium, String ancestor) throws Exception
+ {
+ // just fills out a credit card component
+ selenium.flexSelect(ancestor + "creditCardTypeCombo", "Visa");
+ selenium.flexType(ancestor + "creditCardNameInput", "Fergal Test");
+ selenium.flexType(ancestor + "creditCardNumberInput", "4111 1111 1111 1111");
+ selenium.flexSelect(ancestor + "creditCardExpiryMonthCombo", "02");
+ selenium.flexSelect(ancestor + "creditCardExpiryYearCombo", "2012");
+ selenium.flexType(ancestor + "creditCardSecurityNumberInput", "123");
+ }
+
+ protected void doLogin(DefaultSeleniumFlex selenium, String loginId, String pin) throws Exception
+ {
+ // do a login on the authenticated module
+ openModule(testProperties.getProperty("module.login"), selenium);
+ waitForFlexExists("loginIDInput", 20, selenium);
+ selenium.flexType("loginIDInput", loginId);
+ selenium.flexType("pinInput", pin);
+ assertTrue(selenium.getFlexEnabled("loginBtn") == "true");
+ selenium.flexClick("loginBtn");
+ waitForFlexVisible("_AuthenticatedModule_Button3", 20, selenium);
+ }
+
+ protected void waitForOneFailForTheOther(DefaultSeleniumFlex selenium,
+ String methodWait, String targetWait, String valueWait,
+ String methodFail, String targetFail, String valueFail,
+ int timeOut) throws Exception
+ {
+ Method methWait = selenium.getClass().getMethod(methodWait);
+ Method methFail = selenium.getClass().getMethod(methodFail);
+
+ while(methWait.invoke(selenium, targetWait).equals(valueWait) &&
+ methFail.invoke(selenium, targetFail).equals(valueFail) &&
+ timeOut > 0)
+ {
+ Thread.sleep(1000);
+ timeOut--;
+ }
+
+ if(methFail.invoke(selenium, targetFail).equals(valueFail))
+ {
+ throw new Exception("waitForOneFailForTheOther: " + methodWait +
+ " target: " + targetFail + " - value: " + valueFail);
+ }
+
+ if(timeOut == 0)
+ {
+ throw new Exception("waitForOneFailForTheOther: Timed Out");
+ }
+ }
+
+ protected void continueFailExists(DefaultSeleniumFlex selenium, String continueIf, String failIf) throws Exception
+ {
+ // pass and continue if one element exists, fail and stop if another elements exists
+ int timeOut = 60;
+
+ while(selenium.getFlexExists(continueIf).equals("false") &&
+ selenium.getFlexExists(failIf).equals("false") &&
+ timeOut > 0)
+ {
+ Thread.sleep(1000);
+ timeOut--;
+ }
+ assertTrue(selenium.getFlexExists(continueIf) == "true");
+ assertTrue(selenium.getFlexExists(failIf) == "false");
+ }
+}
+
Index: lams_tool_notebook/test/java/org/lamsfoundation/lams/tool/notebook/testApplicationContext.xml
===================================================================
diff -u
--- lams_tool_notebook/test/java/org/lamsfoundation/lams/tool/notebook/testApplicationContext.xml (revision 0)
+++ lams_tool_notebook/test/java/org/lamsfoundation/lams/tool/notebook/testApplicationContext.xml (revision 94978257a4e34f04f7997f60558db2762811c72b)
@@ -0,0 +1,88 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.hibernate.dialect.MySQLDialect
+ false
+ 5
+ 20
+ 1800
+ 50
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: lams_tool_notebook/test/java/org/lamsfoundation/lams/tool/notebook/testscripts/TestNotebook.java
===================================================================
diff -u
--- lams_tool_notebook/test/java/org/lamsfoundation/lams/tool/notebook/testscripts/TestNotebook.java (revision 0)
+++ lams_tool_notebook/test/java/org/lamsfoundation/lams/tool/notebook/testscripts/TestNotebook.java (revision 94978257a4e34f04f7997f60558db2762811c72b)
@@ -0,0 +1,124 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2.0
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/* $Id$ */
+package org.lamsfoundation.lams.tool.notebook.testscripts;
+
+import org.lamsfoundation.lams.tool.notebook.core.SeleniumBaseTestCase;
+
+public class TestNotebook extends SeleniumBaseTestCase{
+
+ public static final String TOOL_SIGNATURE = "lantbk11";
+ public static final String LEARNING_DESIGN_NAME = "bueno";
+
+ public void testAuthoring() throws Exception {
+ openToolAuthoringWindow(TOOL_SIGNATURE);
+
+ assertEquals("Notebook", selenium.getTitle());
+
+ selenium.type("title", "leave your comment");
+ selenium.runScript("FCKeditorAPI.GetInstance(\"instructions\").SetHTML(\"invent a new way of using Flash\")");
+ selenium.click("tab-middle-link-2");
+ selenium.click("lockOnFinished");
+ selenium.click("tab-middle-link-3");
+ selenium.type("onlineInstruction__lamstextarea", "online instructions");
+
+ storeLearningDesign(TOOL_SIGNATURE, LEARNING_DESIGN_NAME);
+ }
+
+
+// public void testFlex() throws Exception {
+// loginToLams();
+//
+// selenium.click("link=Add Lesson");
+// Thread.sleep(6000);
+//
+// DefaultSeleniumFlex flexSelenium = (DefaultSeleniumFlex)selenium;
+// Thread.sleep(2000);
+// flexSelenium.click("link=Add Lesson");
+// Thread.sleep(6000);
+//// waitForFlexExists("resourceName_txi", 20, flexSelenium);
+//// flexSelenium.wait();
+//// flexSelenium.flexSetFlexObjID("CloudWizard");
+//
+// flexSelenium.flexType("resourceName_txi", "bueno");
+// flexSelenium.flexClick("startButton");
+//
+//// flexSelenium.flexSelect(target)
+// }
+
+//
+// public void testLearning() throws Exception {
+// loginToLams();
+//
+// selenium.click("link=" + LEARNING_DESIGN_NAME);
+// selenium.waitForPopUp("lWindow", "30000");
+// selenium.setSpeed("3000");
+// selenium.selectWindow("lWindow");
+// selenium.setSpeed("1000");
+//
+// assertEquals("LAMS Learner", selenium.getTitle());
+// assertEquals("LAMS Learner", selenium.isElementPresent("//a[@id='finishButton']"));
+//
+// selenium.type("entryText", "have fun");
+// selenium.click("//a[@id='finishButton']/span");
+// selenium.waitForPageToLoad("30000");
+//// assertTrue(selenium.isTextPresent("Congratulations"));
+// assertFalse(selenium.isElementPresent("entryText"));
+// selenium.close();
+// selenium.selectWindow(null);
+//
+// selenium.click("link=" + LEARNING_DESIGN_NAME);
+// selenium.waitForPopUp("lWindow", "30000");
+// selenium.setSpeed("3000");
+// selenium.selectWindow("lWindow");
+// selenium.setSpeed("1000");
+//// assertTrue(selenium.isTextPresent("Congratulations"));
+// assertFalse(selenium.isElementPresent("entryText"));
+// selenium.close();
+// selenium.selectWindow(null);
+// }
+
+// public void testMonitoring() throws Exception {
+//
+// openToolMonitor(TOOL_SIGNATURE, LEARNING_DESIGN_NAME);
+//
+// assertEquals("Notebook", selenium.getTitle());
+//
+// closeToolMonitor();
+// }
+
+
+
+// public void verifyFlexAppSumIsCorrect() {
+// flexUITester.type("2").at("arg1");
+// flexUITester.type("3").at("arg2");
+// flexUITester.click("submit");
+// assertEquals("5", flexUITester.readFrom("result"));
+//
+// assertEquals("Clicking Colors", selenium.getTitle());
+//
+// assertEquals("(Click here)", flashApp.call("getSquareLabel"));
+// flashApp.call("click");
+// }
+
+}
Index: lams_tool_notebook/test/java/org/lamsfoundation/lams/tool/notebook/testscripts/TestNotebookContentDAO.java
===================================================================
diff -u
--- lams_tool_notebook/test/java/org/lamsfoundation/lams/tool/notebook/testscripts/TestNotebookContentDAO.java (revision 0)
+++ lams_tool_notebook/test/java/org/lamsfoundation/lams/tool/notebook/testscripts/TestNotebookContentDAO.java (revision 94978257a4e34f04f7997f60558db2762811c72b)
@@ -0,0 +1,196 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2.0
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/* $Id$ */
+package org.lamsfoundation.lams.tool.notebook.testscripts;
+
+import org.lamsfoundation.lams.tool.notebook.core.NotebookDataAccessTestCase;
+
+
+
+/**
+ * @author mtruong
+ *
+ * JUnit Test Cases to test the NoticeboardContentDAO class
+ */
+public class TestNotebookContentDAO extends NotebookDataAccessTestCase
+{
+ private boolean cleanContentData = true;
+
+ public TestNotebookContentDAO(String name)
+ {
+ super(name);
+ }
+
+ /**
+ * @see NbDataAccessTestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ //set up default noticeboard content for each test
+// initAllData();
+ }
+
+ /**
+ * @see NbDataAccessTestCase#tearDown()
+ */
+ protected void tearDown() throws Exception
+ {
+ //remove noticeboard content after each test
+ if(cleanContentData)
+ {
+// cleanNbContentData(TEST_NB_ID);
+ }
+ }
+
+ public void testfindNbContentByID()
+ {
+// notebook = notebookDAO.getByContentId(TEST_NB_ID);
+
+// assertContentEqualsTestData(notebook);
+
+
+ // Test to see if trying to retrieve a non-existent object would
+ // return null or not.
+
+ Long nonExistentId = new Long(88777);
+ assertTrue(true);
+// assertNbContentIsNull(nonExistentId);
+
+// NoticeboardContent nb = new NoticeboardContent(new Long(3600),
+// TEST_TITLE,
+// TEST_CONTENT,
+// TEST_ONLINE_INSTRUCTIONS,
+// TEST_OFFLINE_INSTRUCTIONS,
+// TEST_DEFINE_LATER,
+// TEST_CONTENT_IN_USE,
+// TEST_FORCE_OFFLINE,
+// TEST_CREATOR_USER_ID,
+// TEST_DATE_CREATED,
+// TEST_DATE_UPDATED);
+//
+// noticeboardDAO.saveNbContent(nb);
+
+ // noticeboardDAO.removeNoticeboard(new Long(3600));
+ // noticeboardDAO.removeNoticeboard(noticeboardDAO.findNbContentById(new Long(3600)));
+
+
+ }
+
+// public void testremoveNoticeboard()
+// {
+// cleanContentData = false;
+//
+// nbContent = noticeboardDAO.findNbContentById(TEST_NB_ID);
+//
+// noticeboardDAO.removeNoticeboard(nbContent);
+//
+// assertNbSessionIsNull(TEST_SESSION_ID); //check if child table is deleted
+// assertNbContentIsNull(TEST_NB_ID);
+// }
+//
+// public void testremoveNoticeboardById()
+// {
+// cleanContentData = false;
+//
+//
+// noticeboardDAO.removeNoticeboard(TEST_NB_ID);
+//
+// assertNbSessionIsNull(TEST_SESSION_ID);
+// assertNbContentIsNull(TEST_NB_ID);
+// }
+//
+// public void testgetNbContentBySession()
+// {
+// nbContent = noticeboardDAO.getNbContentBySession(TEST_SESSION_ID);
+//
+// assertContentEqualsTestData(nbContent);
+// }
+//
+//
+// public void testsaveNbContent()
+// {
+// /**
+// * an object already created when setUp() is called, so dont need to save another instance
+// * TODO: change this, actually test the save method
+// */
+//
+// nbContent = noticeboardDAO.findNbContentById(getTestNoticeboardId());
+//
+// assertContentEqualsTestData(nbContent);
+//
+// }
+//
+// public void testupdateNbContent()
+// {
+// // Update the noticeboard to have a new value for its content field
+// String newContent = "New updated content";
+//
+// nbContent = noticeboardDAO.findNbContentById(getTestNoticeboardId());
+// nbContent.setContent(newContent);
+//
+// noticeboardDAO.updateNbContent(nbContent);
+//
+// //Check whether the value has been updated
+//
+// nbContent = noticeboardDAO.findNbContentById(getTestNoticeboardId());
+//
+// assertEquals(nbContent.getContent(), newContent);
+//
+// }
+//
+// public void testremoveNbSessions()
+// {
+//
+// nbContent = noticeboardDAO.findNbContentById(getTestNoticeboardId());
+//
+//
+// noticeboardDAO.removeNbSessions(nbContent);
+// nbContent.getNbSessions().clear(); //Have to remove/empty the collection before deleting it.
+// //otherwise exception will occur
+// noticeboardDAO.updateNbContent(nbContent);
+// NoticeboardContent nb = noticeboardDAO.findNbContentById(getTestNoticeboardId());
+// assertNotNull(nb);
+// assertNbSessionIsNull(TEST_SESSION_ID);
+// }
+//
+// public void testAddSession()
+// {
+// Long newSessionId = new Long(87);
+// NoticeboardSession newSession = new NoticeboardSession(newSessionId);
+//
+// noticeboardDAO.addNbSession(TEST_NB_ID, newSession);
+//
+// NoticeboardSession retrievedSession = nbSessionDAO.findNbSessionById(newSessionId);
+//
+// assertEquals(retrievedSession.getNbContent().getNbContentId(), TEST_NB_ID);
+//
+// }
+
+
+
+
+
+}
+
+
\ No newline at end of file