You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openmeetings.apache.org by es...@apache.org on 2012/02/19 14:28:09 UTC
svn commit: r1290998 - in /incubator/openmeetings/branches/jira-plugin: ./
src/main/java/org/openmeetings/jira/plugin/ao/adminconfiguration/
src/main/java/org/openmeetings/jira/plugin/ao/omrooms/
src/main/java/org/openmeetings/jira/plugin/gateway/ src/...
Author: eschwert
Date: Sun Feb 19 13:28:08 2012
New Revision: 1290998
URL: http://svn.apache.org/viewvc?rev=1290998&view=rev
Log:
OPENMEETINGS-60 AddRoomWithModrationExttrnalTypeAndTopBarOption method + JunitTest. Reorganize files.
Added:
incubator/openmeetings/branches/jira-plugin/src/main/resources/templates/config/
incubator/openmeetings/branches/jira-plugin/src/main/resources/templates/config/adminedit.vm
incubator/openmeetings/branches/jira-plugin/src/main/resources/templates/config/adminnew.vm
incubator/openmeetings/branches/jira-plugin/src/main/resources/templates/config/omconfig.vm
incubator/openmeetings/branches/jira-plugin/src/test/java/org/openmeetings/jira/plugin/gateway/OmGatawayTest.java
Removed:
incubator/openmeetings/branches/jira-plugin/src/main/resources/templates/adminedit.vm
incubator/openmeetings/branches/jira-plugin/src/main/resources/templates/adminnew.vm
incubator/openmeetings/branches/jira-plugin/src/main/resources/templates/omconfig.vm
Modified:
incubator/openmeetings/branches/jira-plugin/.classpath
incubator/openmeetings/branches/jira-plugin/.project
incubator/openmeetings/branches/jira-plugin/LICENSE
incubator/openmeetings/branches/jira-plugin/pom.xml
incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/ao/adminconfiguration/OmPluginSettings.java
incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/ao/omrooms/Room.java
incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/ao/omrooms/RoomService.java
incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/ao/omrooms/RoomServiceImpl.java
incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/gateway/OmGateway.java
incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/gateway/OmRestService.java
incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/servlet/AdminServlet.java
incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/servlet/RoomsServlet.java
incubator/openmeetings/branches/jira-plugin/src/main/resources/atlassian-plugin.xml
incubator/openmeetings/branches/jira-plugin/src/main/resources/templates/omrooms/list.vm
incubator/openmeetings/branches/jira-plugin/src/test/java/org/openmeetings/jira/plugin/gateway/OmRestServiceTest.java
Modified: incubator/openmeetings/branches/jira-plugin/.classpath
URL: http://svn.apache.org/viewvc/incubator/openmeetings/branches/jira-plugin/.classpath?rev=1290998&r1=1290997&r2=1290998&view=diff
==============================================================================
--- incubator/openmeetings/branches/jira-plugin/.classpath (original)
+++ incubator/openmeetings/branches/jira-plugin/.classpath Sun Feb 19 13:28:08 2012
@@ -132,7 +132,7 @@
<attribute value="jar:file:/home/eschwert/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1-javadoc.jar!/" name="javadoc_location"/>
</attributes>
</classpathentry>
- <classpathentry kind="var" path="M2_REPO/org/springframework/spring-context/2.5.6.SEC02/spring-context-2.5.6.SEC02.jar" sourcepath="M2_REPO/org/springframework/spring-context/2.5.6.SEC02/spring-context-2.5.6.SEC02-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/springframework/spring-context/2.5.6/spring-context-2.5.6.jar" sourcepath="M2_REPO/org/springframework/spring-context/2.5.6/spring-context-2.5.6-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/aopalliance/aopalliance/1.0/aopalliance-1.0.jar" sourcepath="M2_REPO/aopalliance/aopalliance/1.0/aopalliance-1.0-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-beans/2.5.6/spring-beans-2.5.6.jar" sourcepath="M2_REPO/org/springframework/spring-beans/2.5.6/spring-beans-2.5.6-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/com/atlassian/profiling/atlassian-profiling/1.8.2/atlassian-profiling-1.8.2.jar" sourcepath="M2_REPO/com/atlassian/profiling/atlassian-profiling/1.8.2/atlassian-profiling-1.8.2-sources.jar">
@@ -142,7 +142,7 @@
</classpathentry>
<classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-api/1.5.8/slf4j-api-1.5.8.jar" sourcepath="M2_REPO/org/slf4j/slf4j-api/1.5.8/slf4j-api-1.5.8-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/junit/junit/4.6/junit-4.6.jar" sourcepath="M2_REPO/junit/junit/4.6/junit-4.6-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/springframework/spring-web/2.0.6/spring-web-2.0.6.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/springframework/spring-web/2.5.6/spring-web-2.5.6.jar" sourcepath="M2_REPO/org/springframework/spring-web/2.5.6/spring-web-2.5.6-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/com/atlassian/crowd/crowd-core/2.2.8/crowd-core-2.2.8.jar">
<attributes>
<attribute value="jar:file:/home/eschwert/.m2/repository/com/atlassian/crowd/crowd-core/2.2.8/crowd-core-2.2.8-javadoc.jar!/" name="javadoc_location"/>
@@ -164,7 +164,7 @@
</attributes>
</classpathentry>
<classpathentry kind="var" path="M2_REPO/org/springframework/security/spring-security-core/2.0.4/spring-security-core-2.0.4.jar" sourcepath="M2_REPO/org/springframework/security/spring-security-core/2.0.4/spring-security-core-2.0.4-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/springframework/spring-aop/2.0.8/spring-aop-2.0.8.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/springframework/spring-aop/2.5.6/spring-aop-2.5.6.jar" sourcepath="M2_REPO/org/springframework/spring-aop/2.5.6/spring-aop-2.5.6-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-tx/2.5.6/spring-tx-2.5.6.jar" sourcepath="M2_REPO/org/springframework/spring-tx/2.5.6/spring-tx-2.5.6-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/com/atlassian/plugins/atlassian-plugins-core/2.8.0/atlassian-plugins-core-2.8.0.jar" sourcepath="M2_REPO/com/atlassian/plugins/atlassian-plugins-core/2.8.0/atlassian-plugins-core-2.8.0-sources.jar">
<attributes>
@@ -204,6 +204,7 @@
</attributes>
</classpathentry>
<classpathentry kind="var" path="M2_REPO/antlr/antlr/2.7.2/antlr-2.7.2.jar" sourcepath="M2_REPO/antlr/antlr/2.7.2/antlr-2.7.2-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/asm/asm/3.1/asm-3.1.jar" sourcepath="M2_REPO/asm/asm/3.1/asm-3.1-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-orm/2.5.6.SEC02/spring-orm-2.5.6.SEC02.jar" sourcepath="M2_REPO/org/springframework/spring-orm/2.5.6.SEC02/spring-orm-2.5.6.SEC02-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-log4j12/1.5.8/slf4j-log4j12-1.5.8.jar" sourcepath="M2_REPO/org/slf4j/slf4j-log4j12/1.5.8/slf4j-log4j12-1.5.8-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/joda-time/joda-time/1.6/joda-time-1.6.jar" sourcepath="M2_REPO/joda-time/joda-time/1.6/joda-time-1.6-sources.jar">
@@ -860,4 +861,19 @@
<classpathentry kind="var" path="M2_REPO/org/codehaus/woodstox/woodstox-core-asl/4.1.0/woodstox-core-asl-4.1.0.jar" sourcepath="M2_REPO/org/codehaus/woodstox/woodstox-core-asl/4.1.0/woodstox-core-asl-4.1.0-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/codehaus/woodstox/stax2-api/3.1.0/stax2-api-3.1.0.jar" sourcepath="M2_REPO/org/codehaus/woodstox/stax2-api/3.1.0/stax2-api-3.1.0-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-webmvc/2.5.6/spring-webmvc-2.5.6.jar" sourcepath="M2_REPO/org/springframework/spring-webmvc/2.5.6/spring-webmvc-2.5.6-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/com/sun/jersey/contribs/jersey-spring/1.11/jersey-spring-1.11.jar" sourcepath="M2_REPO/com/sun/jersey/contribs/jersey-spring/1.11/jersey-spring-1.11-sources.jar">
+ <attributes>
+ <attribute value="jar:file:/home/eschwert/.m2/repository/com/sun/jersey/contribs/jersey-spring/1.11/jersey-spring-1.11-javadoc.jar!/" name="javadoc_location"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="var" path="M2_REPO/com/sun/jersey/jersey-servlet/1.11/jersey-servlet-1.11.jar" sourcepath="M2_REPO/com/sun/jersey/jersey-servlet/1.11/jersey-servlet-1.11-sources.jar">
+ <attributes>
+ <attribute value="jar:file:/home/eschwert/.m2/repository/com/sun/jersey/jersey-servlet/1.11/jersey-servlet-1.11-javadoc.jar!/" name="javadoc_location"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="var" path="M2_REPO/com/sun/jersey/jersey-server/1.11/jersey-server-1.11.jar" sourcepath="M2_REPO/com/sun/jersey/jersey-server/1.11/jersey-server-1.11-sources.jar">
+ <attributes>
+ <attribute value="jar:file:/home/eschwert/.m2/repository/com/sun/jersey/jersey-server/1.11/jersey-server-1.11-javadoc.jar!/" name="javadoc_location"/>
+ </attributes>
+ </classpathentry>
</classpath>
\ No newline at end of file
Modified: incubator/openmeetings/branches/jira-plugin/.project
URL: http://svn.apache.org/viewvc/incubator/openmeetings/branches/jira-plugin/.project?rev=1290998&r1=1290997&r2=1290998&view=diff
==============================================================================
--- incubator/openmeetings/branches/jira-plugin/.project (original)
+++ incubator/openmeetings/branches/jira-plugin/.project Sun Feb 19 13:28:08 2012
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>openmeetings</name>
- <comment>This is the org.openmeetings.jira.plugin:openmeetings plugin for Atlassian JIRA. It integrates
+ <comment>This is the OpenMeetings plugin for Atlassian JIRA. It integrates
OpenMeeting-Webconferncing with JIRA. NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.</comment>
<projects/>
<buildSpec>
Modified: incubator/openmeetings/branches/jira-plugin/LICENSE
URL: http://svn.apache.org/viewvc/incubator/openmeetings/branches/jira-plugin/LICENSE?rev=1290998&r1=1290997&r2=1290998&view=diff
==============================================================================
--- incubator/openmeetings/branches/jira-plugin/LICENSE (original)
+++ incubator/openmeetings/branches/jira-plugin/LICENSE Sun Feb 19 13:28:08 2012
@@ -1,6 +1,11 @@
-To avoid future confusion, we recommend that you include a license with your plugin.
-This file is simply a reminder.
+ Licensed 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
-For a template license you can have a look at: http://www.opensource.org/licenses/
+ http://www.apache.org/licenses/LICENSE-2.0
-Atlassian releases most of its modules under a BSD license: http://www.opensource.org/licenses/bsd-license.php
+ 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.
\ No newline at end of file
Modified: incubator/openmeetings/branches/jira-plugin/pom.xml
URL: http://svn.apache.org/viewvc/incubator/openmeetings/branches/jira-plugin/pom.xml?rev=1290998&r1=1290997&r2=1290998&view=diff
==============================================================================
--- incubator/openmeetings/branches/jira-plugin/pom.xml (original)
+++ incubator/openmeetings/branches/jira-plugin/pom.xml Sun Feb 19 13:28:08 2012
@@ -118,7 +118,7 @@
<artifactId>google-collections</artifactId>
<version>1.0</version>
<scope>provided</scope>
- </dependency>
+ </dependency>
</dependencies>
<properties>
<amps.version>3.7.2</amps.version>
Modified: incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/ao/adminconfiguration/OmPluginSettings.java
URL: http://svn.apache.org/viewvc/incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/ao/adminconfiguration/OmPluginSettings.java?rev=1290998&r1=1290997&r2=1290998&view=diff
==============================================================================
--- incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/ao/adminconfiguration/OmPluginSettings.java (original)
+++ incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/ao/adminconfiguration/OmPluginSettings.java Sun Feb 19 13:28:08 2012
@@ -19,20 +19,20 @@ public class OmPluginSettings {
public void storeSomeInfo(String key, String value) {
// createGlobalSettings is nice and fast, so there's no need to cache it (it's memoised when necessary).
- pluginSettingsFactory.createGlobalSettings().put("my-plugin-namespace" + key, value);
+ pluginSettingsFactory.createGlobalSettings().put("openmeetings:" + key, value);
}
public Object getSomeInfo(String key) {
- return pluginSettingsFactory.createGlobalSettings().get("my-plugin-namespace" + key);
+ return pluginSettingsFactory.createGlobalSettings().get("openmeetings:" + key);
}
public void storeSomeInfo(String projectKey, String key, String value) {
// createSettingsForKey is nice and fast, so there's no need to cache it (it's memoised when necessary).
- pluginSettingsFactory.createSettingsForKey(projectKey).put("my-plugin-namespace" + key, value);
+ pluginSettingsFactory.createSettingsForKey(projectKey).put("openmeetings:" + key, value);
}
public Object getSomeInfo(String projectKey, String key) {
- return pluginSettingsFactory.createSettingsForKey(projectKey).get("my-plugin-namespace" + key);
+ return pluginSettingsFactory.createSettingsForKey(projectKey).get("openmeetings:" + key);
}
Modified: incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/ao/omrooms/Room.java
URL: http://svn.apache.org/viewvc/incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/ao/omrooms/Room.java?rev=1290998&r1=1290997&r2=1290998&view=diff
==============================================================================
--- incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/ao/omrooms/Room.java (original)
+++ incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/ao/omrooms/Room.java Sun Feb 19 13:28:08 2012
@@ -37,4 +37,8 @@ public interface Room extends Entity
Long getRoomId();
void setRoomId(Long roomId);
+
+ Integer getCreatedByUserId();
+
+ void setCreatedByUserId(Long createdByUserId);
}
Modified: incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/ao/omrooms/RoomService.java
URL: http://svn.apache.org/viewvc/incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/ao/omrooms/RoomService.java?rev=1290998&r1=1290997&r2=1290998&view=diff
==============================================================================
--- incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/ao/omrooms/RoomService.java (original)
+++ incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/ao/omrooms/RoomService.java Sun Feb 19 13:28:08 2012
@@ -8,7 +8,7 @@ import java.util.List;
public interface RoomService
{
Room add(boolean isAllowedRecording, boolean isAudioOnly, boolean isModeratedRoom,
- String name, Long numberOfParticipent, Long roomType);
+ String name, Long numberOfParticipent, Long roomType, Long roomId, Long createdByUserId);
Room update(Integer id, boolean isAllowedRecording, boolean isAudioOnly, boolean isModeratedRoom,
String name, Long numberOfParticipent, Long roomType);
Modified: incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/ao/omrooms/RoomServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/ao/omrooms/RoomServiceImpl.java?rev=1290998&r1=1290997&r2=1290998&view=diff
==============================================================================
--- incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/ao/omrooms/RoomServiceImpl.java (original)
+++ incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/ao/omrooms/RoomServiceImpl.java Sun Feb 19 13:28:08 2012
@@ -18,7 +18,7 @@ public final class RoomServiceImpl imple
@Override
public Room add(boolean isAllowedRecording, boolean isAudioOnly, boolean isModeratedRoom,
- String name, Long numberOfParticipent, Long roomType)
+ String name, Long numberOfParticipent, Long roomType, Long roomId, Long createdByUserId)
{
final Room room = ao.create(Room.class);
@@ -28,6 +28,8 @@ public final class RoomServiceImpl imple
room.setName(name);
room.setNumberOfParticipent(numberOfParticipent);
room.setRoomType(roomType);
+ room.setRoomId(roomId);
+ room.setCreatedByUserId(createdByUserId);
room.save();
return room;
}
Modified: incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/gateway/OmGateway.java
URL: http://svn.apache.org/viewvc/incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/gateway/OmGateway.java?rev=1290998&r1=1290997&r2=1290998&view=diff
==============================================================================
--- incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/gateway/OmGateway.java (original)
+++ incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/gateway/OmGateway.java Sun Feb 19 13:28:08 2012
@@ -1,6 +1,7 @@
package org.openmeetings.jira.plugin.gateway;
import java.io.IOException;
+import java.util.LinkedHashMap;
import javax.servlet.ServletException;
import javax.xml.parsers.ParserConfigurationException;
@@ -11,6 +12,11 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xml.sax.SAXException;
+import org.dom4j.Document;
+import org.dom4j.DocumentException;
+import org.dom4j.Element;
+import org.dom4j.io.SAXReader;
+
import com.atlassian.sal.api.pluginsettings.PluginSettingsFactory;
public class OmGateway {
@@ -19,6 +25,7 @@ public class OmGateway {
private OmRestService omRestService;
private OmPluginSettings omPluginSettings;
+ private String sessionId;
public OmGateway(OmRestService omRestService,
OmPluginSettings omPluginSettings) {
@@ -26,7 +33,7 @@ public class OmGateway {
this.omPluginSettings = omPluginSettings;
}
- public void loginUser() throws XPathExpressionException, IOException, ServletException, SAXException, ParserConfigurationException{
+ public Boolean loginUser() throws XPathExpressionException, IOException, ServletException, SAXException, ParserConfigurationException, DocumentException{
String url = (String)omPluginSettings.getSomeInfo("url");
String port = (String)omPluginSettings.getSomeInfo("port");
@@ -36,7 +43,116 @@ public class OmGateway {
String sessionURL = "http://"+url+":"+port+"/openmeetings/services/UserService/getSession";
- omRestService.call(sessionURL, null);
+ LinkedHashMap<String,Element> elementMap = omRestService.call(sessionURL, null);
+
+ Element item = elementMap.get("return");
+
+ this.setSessionId(item.elementText("session_id"));
+
+ log.error(item.elementText("session_id"));
+
+ LinkedHashMap<String, Element> result = omRestService.call("http://"+url+":"+port+"/openmeetings/services/UserService/loginUser?SID="+this.getSessionId()+"&username="+omusername+"&userpass="+userpass, null);
+
+ //log.error(result.get("return").asXML());
+
+ log.error(result.get("return").getStringValue());
+
+
+ if (Integer.valueOf(result.get("return").getStringValue())>0){
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public Long addRoomWithModerationExternalTypeAndTopBarOption( Boolean isAllowedRecording,
+ Boolean isAudioOnly,
+ Boolean isModeratedRoom,
+ String name,
+ Long numberOfParticipent,
+ Long roomType
+ ) throws XPathExpressionException,
+ IOException,
+ ServletException,
+ SAXException,
+ ParserConfigurationException, DocumentException{
+
+ String testURL = "http://localhost:5080/openmeetings/services/RoomService/addRoomWithModerationExternalTypeAndTopBarOption?" +
+ "SID="+this.getSessionId()+
+ "&name="+name+
+ "&roomtypes_id="+roomType.toString()+
+ "&comment=jira"+
+ "&numberOfPartizipants="+numberOfParticipent.toString()+
+ "&ispublic=false"+
+ "&appointment=false"+
+ "&isDemoRoom=false"+
+ "&demoTime="+
+ "&isModeratedRoom="+isModeratedRoom.toString()+
+ "&externalRoomType=jira"+
+ "&allowUserQuestions="+
+ "&isAudioOnly="+isAudioOnly.toString()+
+ "&waitForRecording=false"+
+ "&allowRecording="+isAllowedRecording.toString()+
+ "&hideTopBar=false";
+
+ LinkedHashMap<String, Element> result = omRestService.call(testURL, null);
+
+ String roomId = result.get("return").getStringValue();
+
+ return Long.valueOf(roomId);
+ }
+
+ public Long updateRoomWithModerationAndQuestions( Boolean isAllowedRecording,
+ Boolean isAudioOnly,
+ Boolean isModeratedRoom,
+ String roomname,
+ Long numberOfParticipent,
+ Long roomType,
+ Long roomId
+ ) throws XPathExpressionException,
+ IOException,
+ ServletException,
+ SAXException,
+ ParserConfigurationException,
+ DocumentException{
+
+
+ String testURL = "http://localhost:5080/openmeetings/services/RoomService/updateRoomWithModerationAndQuestions?" +
+ "SID="+this.getSessionId()+
+ "&room_id="+roomId.toString()+
+ "&name="+roomname.toString()+
+ "&roomtypes_id="+roomType.toString()+
+ "&comment="+
+ "&numberOfPartizipants="+numberOfParticipent.toString()+
+ "&ispublic=false"+
+ "&appointment=false"+
+ "&isDemoRoom=false"+
+ "&demoTime="+
+ "&isModeratedRoom="+isModeratedRoom.toString()+
+ "&allowUserQuestions=";
+
+ //Is not available for update method
+// "&externalRoomType=jira"+
+// "&isAudioOnly="+isAudioOnly+
+// "&waitForRecording=false"+
+// "&allowRecording="+isAllowedRecording+
+// "&hideTopBar=false";
+
+ LinkedHashMap<String, Element> result = omRestService.call(testURL, null);
+
+ log.info("addRoomWithModerationExternalTypeAndTopBarOption with ID: ",result.get("return").getStringValue());
+
+ String updateRoomId = result.get("return").getStringValue();
+
+ return Long.valueOf(updateRoomId);
+ }
+
+ public String getSessionId() {
+ return sessionId;
+ }
+
+ public void setSessionId(String sessionId) {
+ this.sessionId = sessionId;
}
}
Modified: incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/gateway/OmRestService.java
URL: http://svn.apache.org/viewvc/incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/gateway/OmRestService.java?rev=1290998&r1=1290997&r2=1290998&view=diff
==============================================================================
--- incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/gateway/OmRestService.java (original)
+++ incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/gateway/OmRestService.java Sun Feb 19 13:28:08 2012
@@ -1,7 +1,12 @@
package org.openmeetings.jira.plugin.gateway;
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
import javax.servlet.ServletException;
import javax.xml.parsers.DocumentBuilderFactory;
@@ -13,125 +18,124 @@ import org.xml.sax.SAXException;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.methods.PostMethod;
+import org.dom4j.Document;
+import org.dom4j.DocumentException;
+import org.dom4j.Element;
+import org.dom4j.io.SAXReader;
import org.openmeetings.jira.plugin.ao.adminconfiguration.OmPluginSettings;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.sun.jersey.api.client.Client;
+import com.sun.jersey.api.client.ClientResponse;
+import com.sun.jersey.api.client.WebResource;
+import com.sun.jersey.api.client.config.ClientConfig;
+import com.sun.jersey.api.client.config.DefaultClientConfig;
+import com.sun.jersey.api.representation.Form;
+
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.UriBuilder;
+
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+
+
public class OmRestService {
private static final Logger log = LoggerFactory.getLogger(OmRestService.class);
+ private URI getURI(String url) {
+ return UriBuilder.fromUri(
+ url).build();
+ }
- public String call(String request, Object param)throws IOException, ServletException, SAXException, ParserConfigurationException, XPathExpressionException
- {
- //String request = "http://api.search.yahoo.com/WebSearchService/V1/webSearch";
- HttpClient client = new HttpClient();
-
- PostMethod method = new PostMethod(request);
+ private String getEncodetURI(String url) throws MalformedURLException {
+ return new URL(url).toString().replaceAll(" ","%20");
+ }
- // Add POST parameters
-
- method.addParameter("roomId","1");
-//
-// method.addParameter("query","umbrella");
-//
-// method.addParameter("results","10");
-
- // Send POST request
-
- InputStream rstream = null;
-
- // Get the response body
-
- try {
- rstream = method.getResponseBodyAsStream();
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- int statusCode = 0;
- try {
- statusCode = client.executeMethod(method);
- } catch (HttpException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ public LinkedHashMap<String, Element> call(String request, Object param)throws IOException, ServletException, SAXException, ParserConfigurationException, XPathExpressionException, DocumentException
+ {
+
+ //String request= "http://localhost:5080/openmeetings/services/UserService/getSession";
+ HttpClient client = new HttpClient();
+
+ GetMethod method = new GetMethod(getEncodetURI(request).toString());
+ int statusCode = client.executeMethod(method);
+
+ switch (statusCode) {
+
+ case 200: {
+
+ System.out.println("Success connection");
-
-
- switch (statusCode) {
-
- case 200: {
-
- System.out.println("Success connection");
-
- break;
-
- }
- case 400: {
-
- System.out.println("Bad request. The parameters passed to the service did not match as expected. The Message should tell you what was missing or incorrect.");
-
- System.out.println("Change the parameter appcd to appid and this error message will go away.");
-
- break;
+ break;
}
+ case 400: {
+
+ System.out.println("Bad request. The parameters passed to the service did not match as expected. The Message should tell you what was missing or incorrect.");
+ System.out.println("Change the parameter appcd to appid and this error message will go away.");
+
+ break;
+
+ }
+
case 403: {
System.out.println("Forbidden. You do not have permission to access this resource, or are over your rate limit.");
break;
-
+
}
-
+
case 503: {
System.out.println("Service unavailable. An internal problem prevented us from returning data to you.");
break;
-
+
}
-
+
default: System.out.println("Your call to Yahoo! Web Services returned an unexpected HTTP status of: " + statusCode);
-
+
}
+
+ InputStream rstream = null;
+
+ rstream = method.getResponseBodyAsStream();
+
+ BufferedReader br = new BufferedReader(new InputStreamReader(rstream));
+
+ SAXReader reader = new SAXReader();
+ String line;
+ Document document = null;
+ while ((line = br.readLine()) != null) {
+ document = reader.read(new ByteArrayInputStream(line.getBytes("UTF-8")));
+ //System.out.println("line"+line);
+ }
- // Process response
-// Document response = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(rstream);
-//
-//
-// XPathFactory factory = XPathFactory.newInstance();
-// XPath xPath=factory.newXPath();
-//
-// //Get all search Result nodes
-// NodeList nodes = (NodeList)xPath.evaluate("/ResultSet/Result", response, XPathConstants.NODESET);
-// int nodeCount = nodes.getLength();
-//
-// //iterate over search Result nodes
-// for (int i = 0; i < nodeCount; i++) {
-// //Get each xpath expression as a string
-// String title = (String)xPath.evaluate("Title", nodes.item(i), XPathConstants.STRING);
-// String summary = (String)xPath.evaluate("Summary", nodes.item(i), XPathConstants.STRING);
-// String url = (String)xPath.evaluate("Url", nodes.item(i), XPathConstants.STRING);
-// //print out the Title, Summary, and URL for each search result
-// System.out.println("Title: " + title);
-// System.out.println("Summary: " + summary);
-// System.out.println("URL: " + url);
-// System.out.println("--");
-//
-// }
-// System.out.println(rstream);
- return rstream.toString();
+ Element root = document.getRootElement();
+
+ LinkedHashMap<String,Element> elementMap = new LinkedHashMap<String,Element>();
+
+ for ( @SuppressWarnings("unchecked")
+
+ Iterator<Element> i = root.elementIterator(); i.hasNext(); ) {
+ Element item = i.next();
+ String nodeVal = item.getName();
+ elementMap.put(nodeVal, item);
+ }
+
+ return elementMap;
- }
+ }
+
}
Modified: incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/servlet/AdminServlet.java
URL: http://svn.apache.org/viewvc/incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/servlet/AdminServlet.java?rev=1290998&r1=1290997&r2=1290998&view=diff
==============================================================================
--- incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/servlet/AdminServlet.java (original)
+++ incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/servlet/AdminServlet.java Sun Feb 19 13:28:08 2012
@@ -45,9 +45,9 @@ public class AdminServlet extends HttpSe
private OmPluginSettings omPluginSettings;
- private static final String NEW_BROWSER_TEMPLATE = "/templates/adminnew.vm";
- private static final String EDIT_BROWSER_TEMPLATE = "/templates/adminedit.vm";
- private static final String OM_CONFIG_TEMPLATE = "/templates/omconfig.vm";
+ private static final String NEW_BROWSER_TEMPLATE = "/templates/config/adminnew.vm";
+ private static final String EDIT_BROWSER_TEMPLATE = "/templates/config/adminedit.vm";
+ private static final String OM_CONFIG_TEMPLATE = "/templates/config/omconfig.vm";
// public TodoServlet(ActiveObjects ao)
// {
// this.ao = checkNotNull(ao);
Modified: incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/servlet/RoomsServlet.java
URL: http://svn.apache.org/viewvc/incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/servlet/RoomsServlet.java?rev=1290998&r1=1290997&r2=1290998&view=diff
==============================================================================
--- incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/servlet/RoomsServlet.java (original)
+++ incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/servlet/RoomsServlet.java Sun Feb 19 13:28:08 2012
@@ -8,12 +8,15 @@ import javax.servlet.http.HttpServletRes
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.xpath.XPathExpressionException;
+import org.dom4j.DocumentException;
import org.openmeetings.jira.plugin.ao.omrooms.Room;
import org.openmeetings.jira.plugin.ao.omrooms.RoomService;
import org.openmeetings.jira.plugin.gateway.OmGateway;
import org.xml.sax.SAXException;
import com.atlassian.crowd.embedded.api.User;
+import com.atlassian.sal.api.user.UserManager;
+import com.atlassian.jira.ComponentManager;
import com.atlassian.jira.bc.issue.IssueService;
import com.atlassian.jira.issue.Issue;
import com.atlassian.templaterenderer.TemplateRenderer;
@@ -23,7 +26,7 @@ import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;
import java.util.Map;
-
+
import static com.google.common.base.Preconditions.*;
public final class RoomsServlet extends HttpServlet
@@ -31,23 +34,36 @@ public final class RoomsServlet extends
private final RoomService roomService;
private TemplateRenderer templateRenderer;
private OmGateway omGateway;
+ private UserManager userManager;
+ private com.atlassian.jira.user.util.UserManager jiraUserManager;
private static final String LIST_BROWSER_TEMPLATE = "/templates/omrooms/list.vm";
private static final String NEW_BROWSER_TEMPLATE = "/templates/omrooms/new.vm";
private static final String EDIT_BROWSER_TEMPLATE = "/templates/omrooms/edit.vm";
- public RoomsServlet(RoomService roomService, TemplateRenderer templateRenderer, OmGateway omGateway)
+ public RoomsServlet(RoomService roomService, TemplateRenderer templateRenderer, OmGateway omGateway, com.atlassian.jira.user.util.UserManager jiraUserManager, UserManager userManager)
{
this.roomService = checkNotNull(roomService);
this.templateRenderer = templateRenderer;
this.omGateway = omGateway;
+ this.jiraUserManager = jiraUserManager;
+ this.userManager = userManager;
}
+
+ private User getCurrentUser(HttpServletRequest req) {
+ // To get the current user, we first get the username from the session.
+ // Then we pass that over to the jiraUserManager in order to get an
+ // actual User object.
+ //return jiraUserManager.getUser(userManager.getRemoteUsername(req));
+ return jiraUserManager.getUserObject(userManager.getRemoteUsername(req));
+ }
+
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
{
- //User user = getCurrentUser(req);
+ User user = getCurrentUser(req);
if ("y".equals(req.getParameter("new"))) {
// Renders new.vm template if the "new" parameter is passed
@@ -62,25 +78,29 @@ public final class RoomsServlet extends
}else if("y".equals(req.getParameter("edit"))){
// Renders edit.vm template if the "edit" parameter is passed
-
- // Retrieve issue with the specified key
-// IssueService.IssueResult issue = issueService.getIssue(getCurrentUser(req),
-// req.getParameter("key"));
- Integer id = Integer.valueOf(req.getParameter("id"));
+
+ Integer id = Integer.valueOf(req.getParameter("id"));
// Boolean isAllowedRecording = Boolean.valueOf(req.getParameter("isAllowedRecording"));
// Boolean isAudioOnly = Boolean.valueOf(req.getParameter("isAudioOnly"));
// Boolean isModeratedRoom = Boolean.valueOf(req.getParameter("isModeratedRoom"));
-// String name = req.getParameter("name");
+// String roomName = req.getParameter("roomname");
// Long numberOfParticipent = Long.valueOf(req.getParameter("numberOfParticipent"));
-// Long roomType = Long.valueOf(req.getParameter("roomType"));
-
+// Long roomType = Long.valueOf(req.getParameter("roomType"));
+// Long roomId = Long.valueOf(req.getParameter("roomId"));
// Room room = roomService.update(id, isAllowedRecording, isAudioOnly, isModeratedRoom, name, numberOfParticipent, roomType);
Room room = roomService.getRoom(id);
Map<String, Object> context = Maps.newHashMap();
- context.put("issue", room);
+ context.put("room", room);
+// context.put("isAllowedRecording", isAllowedRecording);
+// context.put("isAudioOnly", isAudioOnly);
+// context.put("isModeratedRoom", isModeratedRoom);
+// context.put("roomName", roomName);
+// context.put("numberOfParticipent", numberOfParticipent);
+// context.put("roomType", roomType);
+// context.put("roomId", roomId);
res.setContentType("text/html;charset=utf-8");
// Render the template with the issue inside the context
templateRenderer.render(EDIT_BROWSER_TEMPLATE, context, res.getWriter());
@@ -126,38 +146,100 @@ public final class RoomsServlet extends
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
{
+ User user = getCurrentUser(req);
+ //Second variant to get current user object.
+ //User user2 = (User) ComponentManager.getInstance().getJiraAuthenticationContext().getUser();
+
if ("y".equals(req.getParameter("edit"))) {
-
+
+ Boolean isAllowedRecording = Boolean.valueOf(req.getParameter("isAllowedRecording"));
+ Boolean isAudioOnly = Boolean.valueOf(req.getParameter("isAudioOnly"));
+ Boolean isModeratedRoom = Boolean.valueOf(req.getParameter("isModeratedRoom"));
+ String roomName = req.getParameter("roomname");
+ Long numberOfParticipent = Long.valueOf(req.getParameter("numberOfParticipent"));
+ Long roomType = Long.valueOf(req.getParameter("roomType"));
+ Integer id = Integer.valueOf(req.getParameter("id"));
+ Long roomId = Long.valueOf(req.getParameter("roomId"));
+
+ try {
+ if(omGateway.loginUser()){
+
+ roomId = omGateway.updateRoomWithModerationAndQuestions(
+ isAllowedRecording,
+ isAudioOnly,
+ isModeratedRoom,
+ roomName,
+ numberOfParticipent,
+ roomType,
+ roomId);
+
+ }
+ } catch (XPathExpressionException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (SAXException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (ParserConfigurationException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (DocumentException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+
+
+ roomService.update(id, isAllowedRecording, isAudioOnly, isModeratedRoom, roomName, numberOfParticipent, roomType);
+ //roomService.add(description, true, true, true, "name", 4L, 1L);
+
+ res.sendRedirect(req.getContextPath() + "/plugins/servlet/openmeetingsrooms");
}else{
Boolean isAllowedRecording = Boolean.valueOf(req.getParameter("isAllowedRecording"));
Boolean isAudioOnly = Boolean.valueOf(req.getParameter("isAudioOnly"));
Boolean isModeratedRoom = Boolean.valueOf(req.getParameter("isModeratedRoom"));
- String name = req.getParameter("roomname");
+ String roomName = req.getParameter("roomname");
Long numberOfParticipent = Long.valueOf(req.getParameter("numberOfParticipent"));
Long roomType = Long.valueOf(req.getParameter("roomType"));
+ Long roomId = 0L;
-// try {
-// omGateway.loginUser();
-// } catch (XPathExpressionException e) {
-// // TODO Auto-generated catch block
-// e.printStackTrace();
-// } catch (SAXException e) {
-// // TODO Auto-generated catch block
-// e.printStackTrace();
-// } catch (ParserConfigurationException e) {
-// // TODO Auto-generated catch block
-// e.printStackTrace();
-// }
+ try {
+ if(omGateway.loginUser()){
+
+ roomId = omGateway.addRoomWithModerationExternalTypeAndTopBarOption(
+ isAllowedRecording,
+ isAudioOnly,
+ isModeratedRoom,
+ roomName,
+ numberOfParticipent,
+ roomType
+ );
+
+ }
+ } catch (XPathExpressionException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (SAXException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (ParserConfigurationException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (DocumentException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
- roomService.add(isAllowedRecording, isAudioOnly, isModeratedRoom, name, numberOfParticipent, roomType);
+ roomService.add(isAllowedRecording, isAudioOnly, isModeratedRoom, roomName, numberOfParticipent, roomType, roomId, user.getDirectoryId());
//roomService.add(description, true, true, true, "name", 4L, 1L);
-
+
res.sendRedirect(req.getContextPath() + "/plugins/servlet/openmeetingsrooms");
}
- final String description = req.getParameter("task");
+
+// final String description = req.getParameter("task");
// final String isAllowedRecording = req.getParameter("isAllowedRecording");
// final String isAudioOnly = req.getParameter("isAudioOnly");
// final String isModeratedRoom = req.getParameter("isModeratedRoom");
Modified: incubator/openmeetings/branches/jira-plugin/src/main/resources/atlassian-plugin.xml
URL: http://svn.apache.org/viewvc/incubator/openmeetings/branches/jira-plugin/src/main/resources/atlassian-plugin.xml?rev=1290998&r1=1290997&r2=1290998&view=diff
==============================================================================
--- incubator/openmeetings/branches/jira-plugin/src/main/resources/atlassian-plugin.xml (original)
+++ incubator/openmeetings/branches/jira-plugin/src/main/resources/atlassian-plugin.xml Sun Feb 19 13:28:08 2012
@@ -18,10 +18,13 @@
<link linkId="admin_link" absolute="false">/plugins/servlet/openmeetingsadmin</link>
</web-item>
- <web-section key="my_links_section" name="My Links Main Section" location="my_links_link" weight="10"/>
+ <web-section key="my_links_section" name="My Links Main Section" location="my_links_link" weight="10">
+ <condition class="com.atlassian.jira.plugin.webfragment.conditions.UserLoggedInCondition"/>
+ </web-section>
<web-item key="my_links_link" name="Link on My Links Main Section" section="system.top.navigation.bar" weight="47">
<label>OpenMeetings</label>
<link linkId="my_links_link"/>
+ <condition class="com.atlassian.jira.plugin.webfragment.conditions.UserLoggedInCondition"/>
</web-item>
<web-item key="website_link" name="Rooms Web Site" section="my_links_link/my_links_section" weight="10">
<label>Rooms</label>
Added: incubator/openmeetings/branches/jira-plugin/src/main/resources/templates/config/adminedit.vm
URL: http://svn.apache.org/viewvc/incubator/openmeetings/branches/jira-plugin/src/main/resources/templates/config/adminedit.vm?rev=1290998&view=auto
==============================================================================
--- incubator/openmeetings/branches/jira-plugin/src/main/resources/templates/config/adminedit.vm (added)
+++ incubator/openmeetings/branches/jira-plugin/src/main/resources/templates/config/adminedit.vm Sun Feb 19 13:28:08 2012
@@ -0,0 +1,78 @@
+<html>
+<head>
+ <title>Edit OpenMeetings Configuration</title>
+ <meta name="decorator" content="atl.general">
+</head>
+<body class="page-type-admin">
+<div class="content-container">
+
+ <div class="content-body">
+ <h1>Edit issue omConfig.getKey()</h1>
+
+ #if ($errors.size()>0)
+ <div class="aui-message error shadowed">
+ #foreach($error in $errors)
+ <p class="title">
+ <span class="aui-icon icon-error"></span>
+ <strong>$error</strong>
+ </p>
+ #end
+ </div>
+ <!-- .aui-message -->
+ #end
+
+ <div class="create-issue-panel">
+ <form method="post" id="h" action="openmeetingsconfig" class="aui">
+ <input type="hidden" name="edit" value="y">
+ <input type="hidden" name="key" value="omConfig.getKey()">
+ <div class="field-group">
+ <label for="h-furl">
+ URL
+ <span class="aui-icon icon-required"></span>
+ <span class="content">required</span>
+ </label>
+ <input id="h-furl" class="text long-field" type="text" name="url" value="omConfig.getOmUrl()">
+ </div>
+ <div class="field-group">
+ <label for="h-fport">
+ Port
+ <span class="aui-icon icon-required"></span>
+ <span class="content">required</span>
+ </label>
+ <textarea id="h-fport" name="port">omConfig.getOmPort()</textarea>
+ </div>
+ <div class="field-group">
+ <label for="h-fusername">
+ User Name
+ <span class="aui-icon icon-required"></span>
+ <span class="content">required</span>
+ </label>
+ <textarea id="h-fusername" name="username">omConfig.getOmUserName()</textarea>
+ </div>
+ <div class="field-group">
+ <label for="h-fdescription">
+ User Pass
+ <span class="aui-icon icon-required"></span>
+ <span class="content">required</span>
+ </label>
+ <textarea id="h-fuserpass" name="userpass">omConfig.getOmUserPass()</textarea>
+ </div>
+ <div class="field-group">
+ <label for="h-fdescription">
+ Key
+ <span class="aui-icon icon-required"></span>
+ <span class="content">required</span>
+ </label>
+ <textarea id="h-fkey" name="description">omConfig.getOmKey()</textarea>
+ </div>
+ <div class="buttons">
+ <input class="button" type="submit" value="Update">
+ <a href="openmeetingscrud">Cancel</a>
+ </div>
+ </form>
+ </div>
+ </div>
+
+</div>
+</body>
+</html>
\ No newline at end of file
Added: incubator/openmeetings/branches/jira-plugin/src/main/resources/templates/config/adminnew.vm
URL: http://svn.apache.org/viewvc/incubator/openmeetings/branches/jira-plugin/src/main/resources/templates/config/adminnew.vm?rev=1290998&view=auto
==============================================================================
--- incubator/openmeetings/branches/jira-plugin/src/main/resources/templates/config/adminnew.vm (added)
+++ incubator/openmeetings/branches/jira-plugin/src/main/resources/templates/config/adminnew.vm Sun Feb 19 13:28:08 2012
@@ -0,0 +1,39 @@
+<html>
+<head>
+ <title>Create Issue — Issue CRUD Tutorial</title>
+ <meta name="decorator" content="atl.general">
+</head>
+<body class="page-type-admin">
+<div class="content-container">
+
+ <div class="content-body">
+ <h1>Create issue</h1>
+ <div class="create-issue-panel">
+ <form method="post" id="h" action="openmeetingscrud" class="aui">
+ <div class="field-group">
+ <label for="h-fsummary">
+ Summary
+ <span class="aui-icon icon-required"></span>
+ <span class="content">required</span>
+ </label>
+ <input id="h-fsummary" class="text long-field" type="text" name="summary">
+ </div>
+ <div class="field-group">
+ <label for="h-fdescription">
+ Description
+ <span class="aui-icon icon-required"></span>
+ <span class="content">required</span>
+ </label>
+ <textarea id="h-fdescription" name="description"></textarea>
+ </div>
+ <div class="buttons">
+ <input class="button" type="submit" value="Create">
+ <a href="openmeetingadmin">Cancel</a>
+ </div>
+ </form>
+ </div>
+ </div>
+
+</div>
+</body>
+</html>
\ No newline at end of file
Added: incubator/openmeetings/branches/jira-plugin/src/main/resources/templates/config/omconfig.vm
URL: http://svn.apache.org/viewvc/incubator/openmeetings/branches/jira-plugin/src/main/resources/templates/config/omconfig.vm?rev=1290998&view=auto
==============================================================================
--- incubator/openmeetings/branches/jira-plugin/src/main/resources/templates/config/omconfig.vm (added)
+++ incubator/openmeetings/branches/jira-plugin/src/main/resources/templates/config/omconfig.vm Sun Feb 19 13:28:08 2012
@@ -0,0 +1,61 @@
+<html>
+<head>
+ <title>OpenMeetings Admin — </title>
+ <meta name="decorator" content="atl.general">
+</head>
+<body class="page-type-admin">
+<div class="content-container">
+ <div class="content-body">
+ <h1>OpenMeetings Configuration</h1>
+ <div class="create-issue-panel">
+ <form method="post" id="h" action="openmeetingsadmin" class="aui">
+ <div class="field-group">
+ <label for="h-furl">
+ URL
+ <span class="aui-icon icon-required"></span>
+ <span class="content">required</span>
+ </label>
+ <input id="h-furl" class="text long-field" type="text" name="url" value="$url"></input>
+ </div>
+ <div class="field-group">
+ <label for="h-fport">
+ Port
+ <span class="aui-icon icon-required"></span>
+ <span class="content">required</span>
+ </label>
+ <input id="h-fport" class="text long-field" type="text" name="port" value=$port>
+ </div>
+ <div class="field-group">
+ <label for="h-fusername">
+ Username
+ <span class="aui-icon icon-required"></span>
+ <span class="content">required</span>
+ </label>
+ <input id="h-fusername" class="text long-field" type="text" name="username" value=$username>
+ </div>
+ <div class="field-group">
+ <label for="h-fuserpass">
+ Userpass
+ <span class="aui-icon icon-required"></span>
+ <span class="content">required</span>
+ </label>
+ <input id="h-fuserpass" class="text long-field" type="text" name="userpass" value=$userpass>
+ </div>
+ <div class="field-group">
+ <label for="h-fkey">
+ Key
+ <span class="aui-icon icon-required"></span>
+ <span class="content">required</span>
+ </label>
+ <input id="h-fkey" class="text long-field" type="text" name="key" value=$key>
+ </div>
+ <div class="buttons">
+ <input class="button" type="submit" value="Save">
+ <a href="/secure/AdminSummary.jspa">Cancel</a>
+ </div>
+ </form>
+ </div>
+ </div>
+</div>
+</body>
+</html>
\ No newline at end of file
Modified: incubator/openmeetings/branches/jira-plugin/src/main/resources/templates/omrooms/list.vm
URL: http://svn.apache.org/viewvc/incubator/openmeetings/branches/jira-plugin/src/main/resources/templates/omrooms/list.vm?rev=1290998&r1=1290997&r2=1290998&view=diff
==============================================================================
--- incubator/openmeetings/branches/jira-plugin/src/main/resources/templates/omrooms/list.vm (original)
+++ incubator/openmeetings/branches/jira-plugin/src/main/resources/templates/omrooms/list.vm Sun Feb 19 13:28:08 2012
@@ -46,7 +46,7 @@
<table class="aui">
<thead>
<tr>
- <th>Key</th>
+ <th>RoomId</th>
<th>Roomname</th>
<th>Roomtype</th>
<th>Participent</th>
@@ -58,7 +58,7 @@
<tbody>
#foreach( $room in $rooms )
<tr>
- <td>$room.getKey()</td>
+ <td>$room.getRoomId()</td>
<td>$room.getName()</td>
<td>
#if($room.getRoomType())
Added: incubator/openmeetings/branches/jira-plugin/src/test/java/org/openmeetings/jira/plugin/gateway/OmGatawayTest.java
URL: http://svn.apache.org/viewvc/incubator/openmeetings/branches/jira-plugin/src/test/java/org/openmeetings/jira/plugin/gateway/OmGatawayTest.java?rev=1290998&view=auto
==============================================================================
--- incubator/openmeetings/branches/jira-plugin/src/test/java/org/openmeetings/jira/plugin/gateway/OmGatawayTest.java (added)
+++ incubator/openmeetings/branches/jira-plugin/src/test/java/org/openmeetings/jira/plugin/gateway/OmGatawayTest.java Sun Feb 19 13:28:08 2012
@@ -0,0 +1,137 @@
+package org.openmeetings.jira.plugin.gateway;
+
+import java.io.IOException;
+import org.junit.Test;
+import org.junit.After;
+import org.junit.Before;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.xml.sax.SAXException;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.xpath.XPathExpressionException;
+import org.dom4j.DocumentException;
+import org.dom4j.Element;
+import java.net.URI;
+import java.net.URL;
+import java.util.LinkedHashMap;
+
+import javax.ws.rs.core.UriBuilder;
+
+public class OmGatawayTest {
+ private static final Logger log = LoggerFactory.getLogger(OmRestServiceTest.class);
+
+ HttpServletRequest mockRequest;
+ HttpServletResponse mockResponse;
+
+ private OmRestService omRestService;
+ private String sessionId;
+
+ @Before
+ public void setup() {
+// mockRequest = mock(HttpServletRequest.class);
+// mockResponse = mock(HttpServletResponse.class);
+ omRestService = new OmRestService();
+ }
+
+ @After
+ public void tearDown() {
+
+ }
+
+ private URI getBaseURI() {
+ return UriBuilder.fromUri(
+ "http://localhost:5080/openmeetings/services/UserService/getSession").build();
+ }
+
+ //@Test
+ public void testLogin() throws SAXException, IOException, ParserConfigurationException, XPathExpressionException, ServletException, DocumentException {
+// String expected = "test";
+// when(mockRequest.getParameter(Mockito.anyString())).thenReturn(expected);
+// assertEquals(expected,mockRequest.getParameter("some string"));
+
+
+ String sessionURL = "http://localhost:5080/openmeetings/services/UserService/getSession";
+ LinkedHashMap<String,Element> elementMap = omRestService.call(sessionURL, null);
+
+ Element item = elementMap.get("return");
+
+ log.error(elementMap.toString());
+
+ this.setSessionId(item.elementText("session_id"));
+
+ //log.error(item.elementText("session_id"));
+
+ log.error(item.elementText("session_id"));
+
+ LinkedHashMap<String, Element> result = omRestService.call("http://localhost:5080/openmeetings/services/UserService/loginUser?SID="+this.getSessionId()+"&username=schwert&userpass=schwert", null);
+
+ //log.error(result.get("return").asXML());
+
+ log.error(result.get("return").getStringValue());
+
+
+ if (Integer.valueOf(result.get("return").getStringValue())>0){
+ //return true;
+ } else {
+ //return false;
+ }
+
+ }
+
+ @Test
+ public void testAddRoomWithModerationExternalTypeAndTopBarOption() throws XPathExpressionException, IOException, ServletException, SAXException, ParserConfigurationException, DocumentException{
+
+ this.testLogin();
+
+ String roomname = "test test";
+
+ String testURL = "http://localhost:5080/openmeetings/services/RoomService/addRoomWithModerationExternalTypeAndTopBarOption?" +
+ "SID="+this.getSessionId()+
+ "&name="+roomname+
+ "&roomtypes_id=1"+
+ "&comment="+
+ "&numberOfPartizipants=2"+
+ "&ispublic=true"+
+ "&appointment=false"+
+ "&isDemoRoom=false"+
+ "&demoTime="+
+ "&isModeratedRoom=true"+
+ "&externalRoomType=2"+
+ "&allowUserQuestions="+
+ "&isAudioOnly=false"+
+ "&waitForRecording=false"+
+ "&allowRecording=false"+
+ "&hideTopBar=false";
+
+ log.error("INFO", java.net.URLEncoder.encode(testURL, "UTF-8").toString());
+ System.out.println("INFO "+ java.net.URLEncoder.encode(testURL, "UTF-8"));
+ ///LinkedHashMap<String, Element> result = omRestService.call(java.net.URLDecoder.decode(testURL, "UTF-8").replaceAll("+","%20"), null);
+
+ LinkedHashMap<String, Element> result = omRestService.call(new URL(testURL).toString().replaceAll(" ","%20"), null);
+
+
+ log.error(result.get("return").asXML());
+
+ log.error(result.get("return").getStringValue());
+
+ //return null;
+ }
+
+ public String getSessionId() {
+ return sessionId;
+ }
+
+ public void setSessionId(String sessionId) {
+ this.sessionId = sessionId;
+ }
+
+ private static URI getBaseURI(String url) {
+ return UriBuilder.fromUri(
+ url).build();
+ }
+
+}
Modified: incubator/openmeetings/branches/jira-plugin/src/test/java/org/openmeetings/jira/plugin/gateway/OmRestServiceTest.java
URL: http://svn.apache.org/viewvc/incubator/openmeetings/branches/jira-plugin/src/test/java/org/openmeetings/jira/plugin/gateway/OmRestServiceTest.java?rev=1290998&r1=1290997&r2=1290998&view=diff
==============================================================================
--- incubator/openmeetings/branches/jira-plugin/src/test/java/org/openmeetings/jira/plugin/gateway/OmRestServiceTest.java (original)
+++ incubator/openmeetings/branches/jira-plugin/src/test/java/org/openmeetings/jira/plugin/gateway/OmRestServiceTest.java Sun Feb 19 13:28:08 2012
@@ -1,53 +1,49 @@
package org.openmeetings.jira.plugin.gateway;
+import java.io.ByteArrayInputStream;
import java.io.IOException;
+import java.io.InputStream;
import org.junit.Test;
import org.junit.After;
import org.junit.Before;
-import org.mockito.Mockito;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.w3c.dom.Document;
-import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
-import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.xpath.XPath;
-import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpressionException;
-import javax.xml.xpath.XPathFactory;
-
-import static org.junit.Assert.*;
-import static org.mockito.Mockito.*;
-
import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.WebResource;
import com.sun.jersey.api.client.config.ClientConfig;
import com.sun.jersey.api.client.config.DefaultClientConfig;
-import java.net.URI;
+import org.dom4j.Document;
+import org.dom4j.DocumentException;
+import org.dom4j.Element;
+import org.dom4j.io.SAXReader;
+import java.net.URI;
+import java.util.Iterator;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriBuilder;
+import java.io.*;
+
+import org.apache.commons.httpclient.*;
+import org.apache.commons.httpclient.methods.*;
+
public class OmRestServiceTest {
private static final Logger log = LoggerFactory.getLogger(OmRestServiceTest.class);
HttpServletRequest mockRequest;
HttpServletResponse mockResponse;
- private OmRestService omRestService;
-
@Before
public void setup() {
-// mockRequest = mock(HttpServletRequest.class);
-// mockResponse = mock(HttpServletResponse.class);
- omRestService = new OmRestService();
+new OmRestService();
}
@After
@@ -60,22 +56,12 @@ public class OmRestServiceTest {
"http://localhost:5080/openmeetings/services/UserService/getSession").build();
}
- @Test
- public void testCall() throws SAXException, IOException, ParserConfigurationException, XPathExpressionException {
-// String expected = "test";
-// when(mockRequest.getParameter(Mockito.anyString())).thenReturn(expected);
-// assertEquals(expected,mockRequest.getParameter("some string"));
-
- ///////////
- //String rstream = omRestService.call("http://localhost:5080/openmeetings/services/UserService/getSession", null);
- //log.error("error",rstream);
- ////////////
-
-
-
-// ClientConfig config = new DefaultClientConfig();
-// Client client = Client.create(config);
-// WebResource service = client.resource(getBaseURI());
+ //@Test
+ public void testCallJersey() throws SAXException, IOException, ParserConfigurationException, XPathExpressionException, DocumentException {
+
+ ClientConfig config = new DefaultClientConfig();
+ Client client = Client.create(config);
+ WebResource service = client.resource(getBaseURI());
// // Get XML
// System.out.println(service.path("rest").path("todo").accept(
// MediaType.TEXT_XML).get(String.class));
@@ -88,37 +74,99 @@ public class OmRestServiceTest {
//
// System.out.println(service.accept(
// MediaType.APPLICATION_JSON).get(String.class));
-//
-// String rstream = service.accept(
-// MediaType.TEXT_XML).get(String.class);
-//
+ String rstream2 = service.accept(
+ MediaType.APPLICATION_JSON).get(String.class);
-
-// Document response = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(rstream);
-//
-//
-// XPathFactory factory = XPathFactory.newInstance();
-// XPath xPath=factory.newXPath();
-//
-// //Get all search Result nodes
-// NodeList nodes = (NodeList)xPath.evaluate("/getSessionResponse/return", response, XPathConstants.NODESET);
-// int nodeCount = nodes.getLength();
-//
-// //iterate over search Result nodes
-// for (int i = 0; i < nodeCount; i++) {
-// //Get each xpath expression as a string
-// String title = (String)xPath.evaluate("Title", nodes.item(i), XPathConstants.STRING);
-// String summary = (String)xPath.evaluate("Summary", nodes.item(i), XPathConstants.STRING);
-// String url = (String)xPath.evaluate("Url", nodes.item(i), XPathConstants.STRING);
-// //print out the Title, Summary, and URL for each search result
-// System.out.println("Title: " + title);
-// System.out.println("Summary: " + summary);
-// System.out.println("URL: " + url);
-// System.out.println("--");
-//
-// }
+ SAXReader reader = new SAXReader();
+ Document document = null;
+ try {
+ reader.isValidating();
+ document = reader.read(new ByteArrayInputStream(rstream2.getBytes("UTF-8")));
+ } catch (DocumentException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ Element root = document.getRootElement();
+
+ log.error(root.asXML());
+
+
+ for ( @SuppressWarnings("unchecked")
+
+ Iterator<Element> i = root.elementIterator(); i.hasNext(); ) {
+
+ Element item = i.next();
+
+ log.debug(item.getName());
+ //log.error(item.getNamespacePrefix());
+ //log.error(item.getPath());
+ //log.error(item.getXPathResult(10).getName());//.getPath("/ns:getSessionResponse/ns:return/ax24:session_id"));
+ log.error(item.elementText("session_id"));
+
+ String nodeVal = item.getName();
+
+ }
+
+ }
+
+
+ @Test
+ public void testCallApacheCommons() throws SAXException, IOException, ParserConfigurationException, XPathExpressionException, DocumentException {
+
+
+ String request= "http://localhost:5080/openmeetings/services/UserService/getSession";
+ HttpClient client = new HttpClient();
+
+ GetMethod method = new GetMethod(request);
+
+
+ // Send GET request
+
+ int statusCode = client.executeMethod(method);
+
+ InputStream rstream = null;
+
+ rstream = method.getResponseBodyAsStream();
+
+ BufferedReader br = new BufferedReader(new InputStreamReader(rstream));
+
+ SAXReader reader = new SAXReader();
+ String line;
+ Document document = null;
+ while ((line = br.readLine()) != null) {
+ document = reader.read(new ByteArrayInputStream(line.getBytes("UTF-8")));
+ System.out.println("line"+line);
+
+ }
+
+ //System.out.println("line2"+document.asXML());
+
+ Element root = document.getRootElement();
+
+ log.error(root.asXML());
+
+
+ for ( @SuppressWarnings("unchecked")
+
+ Iterator<Element> i = root.elementIterator(); i.hasNext(); ) {
+
+ Element item = i.next();
+
+ log.debug(item.getName());
+ //log.error(item.getNamespacePrefix());
+ //log.error(item.getPath());
+ //log.error(item.getXPathResult(10).getName());//.getPath("/ns:getSessionResponse/ns:return/ax24:session_id"));
+ log.error(item.elementText("session_id"));
+
+ String nodeVal = item.getName();
+ }
+
+ br.close();
+
}
+
}