- publish/unpublish recording
- get recordings
This commit is contained in:
parent
cdb39d469e
commit
b14b04576d
@ -351,22 +351,29 @@ public class MeetingService implements MessageListener {
|
||||
}
|
||||
|
||||
public void setPublishRecording(List<String> idList, boolean publish) {
|
||||
System.out.println("**** setPublishRecording");
|
||||
|
||||
for (String id : idList) {
|
||||
if (publish) {
|
||||
System.out.println("**** setPublishRecording - publish " + id);
|
||||
recordingService.changeState(id, Recording.STATE_PUBLISHED);
|
||||
} else {
|
||||
System.out.println("**** setPublishRecording - unpublish " + id);
|
||||
recordingService.changeState(id, Recording.STATE_UNPUBLISHED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteRecordings(List<String> idList) {
|
||||
System.out.println("**** deleteRecordings");
|
||||
for (String id : idList) {
|
||||
System.out.println("**** deleteRecordings - deleteRecordings " + id);
|
||||
recordingService.changeState(id, Recording.STATE_DELETED);
|
||||
}
|
||||
}
|
||||
|
||||
public void updateRecordings(List<String> idList, Map<String, String> metaParams) {
|
||||
System.out.println("**** updateRecordings");
|
||||
recordingService.updateMetaParams(idList, metaParams);
|
||||
}
|
||||
|
||||
|
@ -107,35 +107,6 @@ public class RecordingService {
|
||||
return rec;
|
||||
}
|
||||
|
||||
public boolean recordingMatchesMetadata(Recording recording, Map<String, String> metadataFilters) {
|
||||
boolean matchesMetadata = true;
|
||||
for (Map.Entry<String, String> filter : metadataFilters.entrySet()) {
|
||||
String metadataValue = recording.getMetadata().get(filter.getKey());
|
||||
if ( metadataValue == null ) {
|
||||
// The recording doesn't have metadata specified
|
||||
matchesMetadata = false;
|
||||
} else {
|
||||
String filterValue = filter.getValue();
|
||||
if( filterValue.charAt(0) == '%' && filterValue.charAt(filterValue.length()-1) == '%' && metadataValue.contains(filterValue.substring(1, filterValue.length()-1)) ){
|
||||
// Filter value embraced by two wild cards
|
||||
// AND the filter value is part of the metadata value
|
||||
} else if( filterValue.charAt(0) == '%' && metadataValue.endsWith(filterValue.substring(1, filterValue.length())) ) {
|
||||
// Filter value starts with a wild cards
|
||||
// AND the filter value ends with the metadata value
|
||||
} else if( filterValue.charAt(filterValue.length()-1) == '%' && metadataValue.startsWith(filterValue.substring(0, filterValue.length()-1)) ) {
|
||||
// Filter value ends with a wild cards
|
||||
// AND the filter value starts with the metadata value
|
||||
} else if( metadataValue.equals(filterValue) ) {
|
||||
// Filter value doesnt have wildcards
|
||||
// AND the filter value is the same as metadata value
|
||||
} else {
|
||||
matchesMetadata = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return matchesMetadata;
|
||||
}
|
||||
|
||||
public boolean recordingMatchesMetadata(RecordingMetadata recording, Map<String, String> metadataFilters) {
|
||||
boolean matchesMetadata = true;
|
||||
Map<String, String> recMeta = recording.getMeta();
|
||||
@ -176,15 +147,6 @@ public class RecordingService {
|
||||
return resultRecordings;
|
||||
}
|
||||
|
||||
public Map<String, Recording> filterRecordingsByMetadata(Map<String, Recording> recordings, Map<String, String> metadataFilters) {
|
||||
Map<String, Recording> resultRecordings = new HashMap<String, Recording>();
|
||||
for (Map.Entry<String, Recording> entry : recordings.entrySet()) {
|
||||
if (recordingMatchesMetadata(entry.getValue(), metadataFilters))
|
||||
resultRecordings.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
return resultRecordings;
|
||||
}
|
||||
|
||||
public boolean existAnyRecording(List<String> idList) {
|
||||
List<String> publishList = getAllRecordingIds(publishedDir);
|
||||
List<String> unpublishList = getAllRecordingIds(unpublishedDir);
|
||||
@ -503,7 +465,7 @@ public class RecordingService {
|
||||
}
|
||||
|
||||
public void updateMetaParams(List<String> recordIDs, Map<String,String> metaParams) {
|
||||
|
||||
System.out.println("**** updateMetaParams");
|
||||
// Define the directories used to lookup the recording
|
||||
List<String> states = new ArrayList<String>();
|
||||
states.add(Recording.STATE_PUBLISHED);
|
||||
|
@ -25,7 +25,7 @@ public class RecordingMetadata {
|
||||
}
|
||||
|
||||
public void setMeta(Map<String, String> meta) {
|
||||
recMeta.setRecMeta(meta);
|
||||
recMeta = recMeta.setRecMeta(meta);
|
||||
}
|
||||
|
||||
public java.util.Map<String, String> getMeta() {
|
||||
|
@ -43,24 +43,7 @@ public class RecordingMetadataReaderHelper {
|
||||
}
|
||||
|
||||
public void saveRecordingMetadata(File metadataXml, RecordingMetadata recordingMetadata) {
|
||||
|
||||
//XMLOutputFactory factory = XMLOutputFactory.newInstance();
|
||||
JacksonXmlModule module = new JacksonXmlModule();
|
||||
module.setDefaultUseWrapper(false);
|
||||
|
||||
XmlMapper mapper = new XmlMapper(module);
|
||||
|
||||
//Reading from xml file and creating XMLStreamReader
|
||||
//XMLStreamWriter writer = null;
|
||||
try {
|
||||
//writer = factory.createXMLStreamWriter(new FileOutputStream(metadataXml));
|
||||
mapper.enable(SerializationFeature.INDENT_OUTPUT);
|
||||
mapper.writeValue(metadataXml, recordingMetadata);
|
||||
} catch (FileNotFoundException e) {
|
||||
log.error("File not found: " + metadataXml.getAbsolutePath(), e);
|
||||
} catch (IOException e) {
|
||||
log.error("IOException on " + metadataXml.getAbsolutePath(), e);
|
||||
}
|
||||
recordingServiceGW.saveRecordingMetadata(metadataXml, recordingMetadata);
|
||||
}
|
||||
|
||||
public void setRecordingServiceGW(RecordingServiceGW recordingServiceGW) {
|
||||
|
@ -11,4 +11,5 @@ public interface RecordingServiceGW {
|
||||
|
||||
String getRecordings2x(ArrayList<RecordingMetadata> recs);
|
||||
Option<RecordingMetadata> getRecordingMetadata(File xml);
|
||||
void saveRecordingMetadata(File xml, RecordingMetadata metadata);
|
||||
}
|
||||
|
@ -188,11 +188,30 @@ case class RecMeta(id: String, meetingId: String, internalMeetingId: Option[ Str
|
||||
}
|
||||
}
|
||||
|
||||
def setRecMeta(m: java.util.Map[String, String]): Unit = {
|
||||
def setRecMeta(m: java.util.Map[String, String]): RecMeta = {
|
||||
this.copy(meta = Some((m.asScala).toMap))
|
||||
}
|
||||
|
||||
def toXml(): Elem = {
|
||||
|
||||
def metaToElem(map: scala.collection.immutable.Map[String, String]): Elem = {
|
||||
val buffer = new scala.xml.NodeBuffer
|
||||
|
||||
map.foreach {case (key, value) =>
|
||||
val m = "<" + key + ">" + value + "</" + key + ">"
|
||||
buffer += scala.xml.XML.loadString(m)
|
||||
}
|
||||
<metadata>{buffer}</metadata>
|
||||
}
|
||||
|
||||
def breakoutRoomsToElem(rooms: Vector[String]): Elem = {
|
||||
val buffer = new scala.xml.NodeBuffer
|
||||
|
||||
rooms foreach(r => buffer += <breakoutRoom>{r}</breakoutRoom>)
|
||||
|
||||
<breakoutRooms>{buffer}</breakoutRooms>
|
||||
}
|
||||
|
||||
val recordIdElem = <recordID>{id}</recordID>
|
||||
val meetingIdElem = <meetingID>{meetingId}</meetingID>
|
||||
val meetingNameElem = <name>{meetingName}</name>
|
||||
@ -232,27 +251,71 @@ case class RecMeta(id: String, meetingId: String, internalMeetingId: Option[ Str
|
||||
<recording>{buffer}</recording>
|
||||
}
|
||||
|
||||
def metaToElem(map: scala.collection.immutable.Map[String, String]): Elem = {
|
||||
val buffer = new scala.xml.NodeBuffer
|
||||
def toMetadataXml(): Elem = {
|
||||
val recordIdElem = <id>{id}</id>
|
||||
val stateElem = <state>{state}</state>
|
||||
val publishedElem = <published>{published}</published>
|
||||
val startTimeElem = <start_time>{startTime}</start_time>
|
||||
val endTimeElem = <end_time>{endTime}</end_time>
|
||||
val participantsElem = <participants>{participants}</participants>
|
||||
val rawSizeElem = <raw_size>{rawSize}</raw_size>
|
||||
|
||||
map.foreach {case (key, value) =>
|
||||
val m = "<" + key + ">" + value + "</" + key + ">"
|
||||
buffer += scala.xml.XML.loadString(m)
|
||||
val buffer = new scala.xml.NodeBuffer
|
||||
buffer += recordIdElem
|
||||
buffer += stateElem
|
||||
buffer += publishedElem
|
||||
buffer += startTimeElem
|
||||
buffer += endTimeElem
|
||||
buffer += participantsElem
|
||||
|
||||
meeting foreach { m =>
|
||||
buffer += m.toMetadataXml()
|
||||
}
|
||||
<metadata>{buffer}</metadata>
|
||||
}
|
||||
|
||||
def breakoutRoomsToElem(rooms: Vector[String]): Elem = {
|
||||
val buffer = new scala.xml.NodeBuffer
|
||||
def metaToElem(map: scala.collection.immutable.Map[String, String]): Elem = {
|
||||
val buffer = new scala.xml.NodeBuffer
|
||||
|
||||
rooms foreach(r => buffer += <breakoutRoom>{r}</breakoutRoom>)
|
||||
map.foreach {case (key, value) =>
|
||||
val m = "<" + key + ">" + value + "</" + key + ">"
|
||||
buffer += scala.xml.XML.loadString(m)
|
||||
}
|
||||
<meta>{buffer}</meta>
|
||||
}
|
||||
|
||||
<breakoutRooms>{buffer}</breakoutRooms>
|
||||
meta foreach (m => buffer += metaToElem(m))
|
||||
breakout foreach (b => buffer += b.toMetadataXml())
|
||||
|
||||
def breakoutRoomsToElem(rooms: Vector[String]): Elem = {
|
||||
val buffer = new scala.xml.NodeBuffer
|
||||
|
||||
rooms foreach(r => buffer += <breakoutRoom>{r}</breakoutRoom>)
|
||||
|
||||
<breakoutRooms>{buffer}</breakoutRooms>
|
||||
}
|
||||
|
||||
if (breakoutRooms.nonEmpty) {
|
||||
buffer += breakoutRoomsToElem(breakoutRooms)
|
||||
}
|
||||
|
||||
playback foreach(p => buffer += p.toMetadataXml())
|
||||
|
||||
buffer += rawSizeElem
|
||||
|
||||
<recording>{buffer}</recording>
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
case class RecMetaMeeting(id: String, externalId: String, name: String, breakout: Boolean)
|
||||
case class RecMetaMeeting(id: String, externalId: String, name: String, breakout: Boolean) {
|
||||
def toXml(): Elem = {
|
||||
<meeting id={id} externalId={externalId} name={name} breakout={breakout.toString}/>
|
||||
}
|
||||
|
||||
def toMetadataXml(): Elem = {
|
||||
<meeting id={id} externalId={externalId} name={name} breakout={breakout.toString}/>
|
||||
}
|
||||
}
|
||||
|
||||
case class RecMetaPlayback(format: String, link: String, processingTime: Int,
|
||||
duration: Int, size: Int, extensions: Option[scala.xml.NodeSeq]) {
|
||||
def toXml(): Elem = {
|
||||
@ -277,6 +340,27 @@ case class RecMetaPlayback(format: String, link: String, processingTime: Int,
|
||||
|
||||
<playback>{buffer}</playback>
|
||||
}
|
||||
|
||||
def toMetadataXml(): Elem = {
|
||||
val buffer = new scala.xml.NodeBuffer
|
||||
|
||||
val formatElem = <format>{format}</format>
|
||||
val urlElem = <url>{link}</url>
|
||||
val processTimeElem = <processingTime>{processingTime}</processingTime>
|
||||
val lengthElem = <length>{duration}</length>
|
||||
|
||||
buffer += formatElem
|
||||
buffer += urlElem
|
||||
buffer += processTimeElem
|
||||
buffer += lengthElem
|
||||
|
||||
|
||||
extensions foreach {ext =>
|
||||
buffer += ext.head
|
||||
}
|
||||
|
||||
<playback>{buffer}</playback>
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -294,4 +378,8 @@ case class RecMetaBreakout(parentId: String, sequence: Int, meetingId: String) {
|
||||
|
||||
<breakout>{buffer}</breakout>
|
||||
}
|
||||
|
||||
def toMetadataXml(): Elem = {
|
||||
<breakout parentMeetingId={parentId} sequence={sequence.toString} meetingId={meetingId}/>
|
||||
}
|
||||
}
|
||||
|
@ -1,20 +1,22 @@
|
||||
package org.bigbluebutton.api2.util
|
||||
|
||||
import java.io.{File, IOException}
|
||||
import java.io.{File, FileOutputStream, IOException}
|
||||
import java.nio.channels.Channels
|
||||
import java.util
|
||||
|
||||
import org.bigbluebutton.api.domain.RecordingMetadata
|
||||
import org.bigbluebutton.api2.RecordingServiceGW
|
||||
import org.bigbluebutton.api2.domain.{RecMeta, RecMetaBreakout, RecMetaMeeting, RecMetaPlayback}
|
||||
import org.bigbluebutton.api2.domain.RecMeta
|
||||
|
||||
import scala.xml.{Elem, NodeSeq, XML}
|
||||
import scala.xml.{Elem, PrettyPrinter, XML}
|
||||
import scala.collection.JavaConverters._
|
||||
|
||||
class RecMetaXmlHelper extends RecordingServiceGW with LogHelper {
|
||||
|
||||
def loadMetadataXml(path: String): Option[Elem] = {
|
||||
try {
|
||||
val xml = XML.loadFile(path)
|
||||
//val xml = XML.loadFile(path)
|
||||
val xml = XML.load(new java.io.InputStreamReader(new java.io.FileInputStream(path), "UTF-8"))
|
||||
Some(xml)
|
||||
} catch {
|
||||
case ioe: IOException =>
|
||||
@ -27,6 +29,41 @@ class RecMetaXmlHelper extends RecordingServiceGW with LogHelper {
|
||||
}
|
||||
}
|
||||
|
||||
def saveRecordingMetadata(xml: File, metadata: RecordingMetadata): Unit = {
|
||||
println("Saving metadata.xml to " + xml.getAbsolutePath)
|
||||
println(" METADATAXML \n " + metadata.getRecMeta.toMetadataXml())
|
||||
/*
|
||||
try {
|
||||
scala.xml.XML.save(xml.getAbsolutePath, metadata.getRecMeta.toMetadataXml(), "UTF-8", true, null)
|
||||
} catch {
|
||||
case ioe: IOException =>
|
||||
logger.info("Failed to save metadataxml {}", xml.getAbsolutePath)
|
||||
case ex: Exception =>
|
||||
logger.info("Exception while saving {}", xml.getAbsolutePath)
|
||||
logger.info("Exception details: {}", ex.getMessage)
|
||||
}
|
||||
*/
|
||||
try {
|
||||
val Encoding = "UTF-8"
|
||||
val pp = new PrettyPrinter(80, 2)
|
||||
val fos = new FileOutputStream(xml.getAbsolutePath)
|
||||
val writer = Channels.newWriter(fos.getChannel(), Encoding)
|
||||
|
||||
try {
|
||||
writer.write("<?xml version='1.0' encoding='" + Encoding + "'?>\n")
|
||||
writer.write(pp.format(metadata.getRecMeta.toMetadataXml()))
|
||||
} finally {
|
||||
writer.close()
|
||||
}
|
||||
} catch {
|
||||
case ioe: IOException =>
|
||||
logger.info("Failed to save metadataxml {}", xml.getAbsolutePath)
|
||||
case ex: Exception =>
|
||||
logger.info("Exception while saving {}", xml.getAbsolutePath)
|
||||
logger.info("Exception details: {}", ex.getMessage)
|
||||
}
|
||||
}
|
||||
|
||||
def getRecordingMetadata(xml: File): Option[RecordingMetadata] = {
|
||||
loadMetadataXml(xml.getAbsolutePath) match {
|
||||
case Some(mXML) =>
|
||||
|
@ -1,236 +0,0 @@
|
||||
package org.bigbluebutton.api.util
|
||||
|
||||
import java.io.File
|
||||
import java.util
|
||||
|
||||
import org.apache.commons.io.FileUtils
|
||||
import org.bigbluebutton.api.domain.{Meeting, RecordingMetadata, User}
|
||||
import org.scalatest._
|
||||
|
||||
class ResponseBuilderTest extends UnitSpec {
|
||||
|
||||
it should "find template" in {
|
||||
val current = new java.io.File( "." ).getCanonicalPath()
|
||||
println("Current dir:"+current)
|
||||
|
||||
|
||||
|
||||
val meetingInfo = new util.TreeMap[String, String]()
|
||||
meetingInfo.put("foo", "foo")
|
||||
meetingInfo.put("bar", "baz")
|
||||
|
||||
val meeting: Meeting = new Meeting.Builder("extMid", "intMid", System.currentTimeMillis())
|
||||
.withName("Demo Meeting").withMaxUsers(25)
|
||||
.withModeratorPass("mp").withViewerPass("ap")
|
||||
.withRecording(true).withDuration(600)
|
||||
.withLogoutUrl("/logoutUrl").withTelVoice("85115").withWebVoice("85115")
|
||||
.withDialNumber("6135551234").withDefaultAvatarURL("/avatar")
|
||||
.withAutoStartRecording(false).withAllowStartStopRecording(true)
|
||||
.withWebcamsOnlyForModerator(false).withMetadata(meetingInfo)
|
||||
.withWelcomeMessageTemplate("hello").withWelcomeMessage("hello")
|
||||
.isBreakout(false).build
|
||||
|
||||
meeting.setParentMeetingId("ParentMeetingId")
|
||||
meeting.setSequence(0);
|
||||
|
||||
meeting.addBreakoutRoom("breakout-room-id-1")
|
||||
meeting.addBreakoutRoom("breakout-room-id-2")
|
||||
meeting.addBreakoutRoom("breakout-room-id-3")
|
||||
|
||||
val user: User = new User("uid1", "extuid1", "Richard", "moderator", "/aygwapo", false, false)
|
||||
meeting.userJoined(user)
|
||||
|
||||
val user2: User = new User("uid2", "extuid2", "Richard 2", "moderator", "/aygwapo", false, false)
|
||||
meeting.userJoined(user2)
|
||||
|
||||
val user3: User = new User("uid3", "extuid3", "Richard 3", "moderator", "/aygwapo", false, false)
|
||||
meeting.userJoined(user2)
|
||||
|
||||
val custData = new util.HashMap[String, String]()
|
||||
custData.put("gwapo", "totoo")
|
||||
|
||||
meeting.addUserCustomData("extuid1", custData)
|
||||
|
||||
val templateLoc = new File("src/test/resources")
|
||||
val builder = new ResponseBuilder(templateLoc)
|
||||
def response = builder.buildGetMeetingInfoResponse(meeting, "success")
|
||||
// println(response)
|
||||
|
||||
assert(templateLoc.exists())
|
||||
}
|
||||
|
||||
it should "return meetings" in {
|
||||
val meetingInfo1 = new util.TreeMap[String, String]()
|
||||
meetingInfo1.put("foo", "foo")
|
||||
meetingInfo1.put("bar", "baz")
|
||||
|
||||
val meeting1: Meeting = new Meeting.Builder("extMid1", "intMid1", System.currentTimeMillis())
|
||||
.withName("Demo Meeting 1").withMaxUsers(25)
|
||||
.withModeratorPass("mp").withViewerPass("ap")
|
||||
.withRecording(true).withDuration(600)
|
||||
.withLogoutUrl("/logoutUrl").withTelVoice("85115").withWebVoice("85115")
|
||||
.withDialNumber("6135551234").withDefaultAvatarURL("/avatar")
|
||||
.withAutoStartRecording(false).withAllowStartStopRecording(true)
|
||||
.withWebcamsOnlyForModerator(false).withMetadata(meetingInfo1)
|
||||
.withWelcomeMessageTemplate("hello").withWelcomeMessage("hello")
|
||||
.isBreakout(false).build
|
||||
|
||||
meeting1.setParentMeetingId("ParentMeetingId")
|
||||
meeting1.setSequence(0);
|
||||
|
||||
meeting1.addBreakoutRoom("breakout-room-id-1")
|
||||
meeting1.addBreakoutRoom("breakout-room-id-2")
|
||||
meeting1.addBreakoutRoom("breakout-room-id-3")
|
||||
|
||||
val userm11: User = new User("uid1", "extuid1", "Richard", "moderator", "/aygwapo", false, false)
|
||||
meeting1.userJoined(userm11)
|
||||
|
||||
val userm12: User = new User("uid2", "extuid2", "Richard 2", "moderator", "/aygwapo", false, false)
|
||||
meeting1.userJoined(userm12)
|
||||
|
||||
val userm13: User = new User("uid3", "extuid3", "Richard 3", "moderator", "/aygwapo", false, false)
|
||||
meeting1.userJoined(userm13)
|
||||
|
||||
val custDatam1 = new util.HashMap[String, String]()
|
||||
custDatam1.put("gwapo", "totoo")
|
||||
|
||||
meeting1.addUserCustomData("extuid1", custDatam1)
|
||||
|
||||
val meetingInfo2 = new util.TreeMap[String, String]()
|
||||
meetingInfo2.put("foo", "foo")
|
||||
meetingInfo2.put("bar", "baz")
|
||||
|
||||
val meeting2: Meeting = new Meeting.Builder("extMid2", "intMid2", System.currentTimeMillis())
|
||||
.withName("Demo Meeting 2").withMaxUsers(25)
|
||||
.withModeratorPass("mp").withViewerPass("ap")
|
||||
.withRecording(true).withDuration(600)
|
||||
.withLogoutUrl("/logoutUrl").withTelVoice("85115").withWebVoice("85115")
|
||||
.withDialNumber("6135551234").withDefaultAvatarURL("/avatar")
|
||||
.withAutoStartRecording(false).withAllowStartStopRecording(true)
|
||||
.withWebcamsOnlyForModerator(false).withMetadata(meetingInfo2)
|
||||
.withWelcomeMessageTemplate("hello").withWelcomeMessage("hello")
|
||||
.isBreakout(false).build
|
||||
|
||||
meeting2.setParentMeetingId("ParentMeetingId")
|
||||
meeting2.setSequence(0);
|
||||
|
||||
meeting2.addBreakoutRoom("breakout-room-id-1")
|
||||
meeting2.addBreakoutRoom("breakout-room-id-2")
|
||||
meeting2.addBreakoutRoom("breakout-room-id-3")
|
||||
|
||||
val userm21: User = new User("uid1", "extuid1", "Richard", "moderator", "/aygwapo", false, false)
|
||||
meeting2.userJoined(userm21)
|
||||
|
||||
val userm22: User = new User("uid2", "extuid2", "Richard 2", "moderator", "/aygwapo", false, false)
|
||||
meeting2.userJoined(userm22)
|
||||
|
||||
val userm23: User = new User("uid3", "extuid3", "Richard 3", "moderator", "/aygwapo", false, false)
|
||||
meeting2.userJoined(userm23)
|
||||
|
||||
val custDatam2 = new util.HashMap[String, String]()
|
||||
custDatam2.put("gwapo", "totoo")
|
||||
|
||||
meeting2.addUserCustomData("extuid1", custDatam2)
|
||||
|
||||
|
||||
val meetingInfo3 = new util.TreeMap[String, String]()
|
||||
meetingInfo3.put("foo", "foo")
|
||||
meetingInfo3.put("bar", "baz")
|
||||
|
||||
val meeting3: Meeting = new Meeting.Builder("extMid", "intMid", System.currentTimeMillis())
|
||||
.withName("Demo Meeting").withMaxUsers(25)
|
||||
.withModeratorPass("mp").withViewerPass("ap")
|
||||
.withRecording(true).withDuration(600)
|
||||
.withLogoutUrl("/logoutUrl").withTelVoice("85115").withWebVoice("85115")
|
||||
.withDialNumber("6135551234").withDefaultAvatarURL("/avatar")
|
||||
.withAutoStartRecording(false).withAllowStartStopRecording(true)
|
||||
.withWebcamsOnlyForModerator(false).withMetadata(meetingInfo3)
|
||||
.withWelcomeMessageTemplate("hello").withWelcomeMessage("hello")
|
||||
.isBreakout(false).build
|
||||
|
||||
meeting3.setParentMeetingId("ParentMeetingId")
|
||||
meeting3.setSequence(0);
|
||||
|
||||
meeting3.addBreakoutRoom("breakout-room-id-1")
|
||||
meeting3.addBreakoutRoom("breakout-room-id-2")
|
||||
meeting3.addBreakoutRoom("breakout-room-id-3")
|
||||
|
||||
val user: User = new User("uid1", "extuid1", "Richard", "moderator", "/aygwapo", false, false)
|
||||
meeting3.userJoined(user)
|
||||
|
||||
val user2: User = new User("uid2", "extuid2", "Richard 2", "moderator", "/aygwapo", false, false)
|
||||
meeting3.userJoined(user2)
|
||||
|
||||
val user3: User = new User("uid3", "extuid3", "Richard 3", "moderator", "/aygwapo", false, false)
|
||||
meeting3.userJoined(user2)
|
||||
|
||||
val custData = new util.HashMap[String, String]()
|
||||
custData.put("gwapo", "totoo")
|
||||
|
||||
meeting3.addUserCustomData("extuid1", custData)
|
||||
|
||||
|
||||
|
||||
val meetings = new util.ArrayList[Meeting]()
|
||||
meetings.add(meeting1)
|
||||
meetings.add(meeting2)
|
||||
meetings.add(meeting3)
|
||||
|
||||
val templateLoc = new File("src/test/resources")
|
||||
val builder = new ResponseBuilder(templateLoc)
|
||||
def response = builder.buildGetMeetingsResponse(meetings, "success")
|
||||
// println(response)
|
||||
|
||||
assert(templateLoc.exists())
|
||||
}
|
||||
|
||||
it should "reply to getRecordings api call" in {
|
||||
val templateLoc = new File("src/test/resources")
|
||||
val builder = new ResponseBuilder(templateLoc)
|
||||
|
||||
val metadataXml = new File("src/test/resources/breakout-room-metadata.xml")
|
||||
val recMeta = RecordingMetadataReaderHelper.getRecordingMetadata(metadataXml);
|
||||
val recList = new util.ArrayList[RecordingMetadata]()
|
||||
recList.add(recMeta)
|
||||
def response = builder.buildGetRecordingsResponse(recList, "success")
|
||||
println(response)
|
||||
|
||||
assert(templateLoc.exists())
|
||||
}
|
||||
|
||||
/**
|
||||
it should "support old metadata.xml in getRecordings api call" in {
|
||||
val templateLoc = new File("src/test/resources")
|
||||
val builder = new ResponseBuilder(templateLoc)
|
||||
|
||||
// Make a copy of our sample recording
|
||||
val destDir = new File("target/recording-metadata/presentation")
|
||||
if (destDir.exists()) FileUtils.deleteDirectory(destDir)
|
||||
|
||||
val srcDir = new File("src/test/resources/recording-metadata/presentation")
|
||||
FileUtils.copyDirectory(srcDir, destDir)
|
||||
|
||||
val recDirs = destDir.listFiles()
|
||||
val recList = new util.ArrayList[RecordingMetadata]()
|
||||
println("START **********************")
|
||||
|
||||
recDirs.map {rec =>
|
||||
val metadataXml = new File(rec.getAbsolutePath + File.separatorChar + "metadata.xml")
|
||||
// println(metadataXml.getAbsolutePath)
|
||||
val recMeta = RecordingMetadataReaderHelper.getRecordingMetadata(metadataXml);
|
||||
// val recList = new util.ArrayList[RecordingMetadata]()
|
||||
// println("START **********************")
|
||||
if (recMeta != null) recList.add(recMeta)
|
||||
// val response = builder.buildGetRecordingsResponse(recList, "success")
|
||||
// println(response)
|
||||
// println("END **********************")
|
||||
}
|
||||
|
||||
val response = builder.buildGetRecordingsResponse(recList, "success")
|
||||
println(response)
|
||||
println("END **********************")
|
||||
|
||||
assert(templateLoc.exists())
|
||||
}
|
||||
**/
|
||||
}
|
@ -1,21 +1,25 @@
|
||||
package org.bigbluebutton.api2.util
|
||||
|
||||
import org.bigbluebutton.api.util.UnitSpec
|
||||
import org.bigbluebutton.api2.domain.RecMeta
|
||||
|
||||
class RecMetaXmlHelperTests extends UnitSpec {
|
||||
|
||||
val metaFile = "src/test/resources/sample-metadata.xml"
|
||||
|
||||
it should "load metadata xml" in {
|
||||
val xml = RecMetaXmlHelper.loadMetadataXml(metaFile)
|
||||
val helper = new RecMetaXmlHelper
|
||||
|
||||
val xml = helper.loadMetadataXml(metaFile)
|
||||
// println("METADATAXML = \n" + xml)
|
||||
}
|
||||
|
||||
it should "get meta elements" in {
|
||||
val xml = RecMetaXmlHelper.loadMetadataXml(metaFile)
|
||||
val helper = new RecMetaXmlHelper
|
||||
val xml = helper.loadMetadataXml(metaFile)
|
||||
xml match {
|
||||
case Some(metaXml) =>
|
||||
RecMetaXmlHelper.getMeta(metaXml) match {
|
||||
RecMeta.getMeta(metaXml) match {
|
||||
case Some(meta) =>
|
||||
assert(meta.size == 8)
|
||||
case None => fail("Failed to get meta element.")
|
||||
@ -26,10 +30,11 @@ class RecMetaXmlHelperTests extends UnitSpec {
|
||||
}
|
||||
|
||||
it should "get meeting element" in {
|
||||
val xml = RecMetaXmlHelper.loadMetadataXml(metaFile)
|
||||
val helper = new RecMetaXmlHelper
|
||||
val xml = helper.loadMetadataXml(metaFile)
|
||||
xml match {
|
||||
case Some(metaXml) =>
|
||||
RecMetaXmlHelper.getMeeting(metaXml) match {
|
||||
RecMeta.getMeeting(metaXml) match {
|
||||
case Some(meeting) =>
|
||||
assert(meeting.id == "b27af2f930d418879550e09c7548d1cdd0be25cf-1504122319984")
|
||||
assert(meeting.breakout == false)
|
||||
@ -41,10 +46,11 @@ class RecMetaXmlHelperTests extends UnitSpec {
|
||||
}
|
||||
|
||||
it should "get playback element" in {
|
||||
val xml = RecMetaXmlHelper.loadMetadataXml(metaFile)
|
||||
val helper = new RecMetaXmlHelper
|
||||
val xml = helper.loadMetadataXml(metaFile)
|
||||
xml match {
|
||||
case Some(metaXml) =>
|
||||
RecMetaXmlHelper.getPlayback(metaXml) match {
|
||||
RecMeta.getPlayback(metaXml) match {
|
||||
case Some(playback) =>
|
||||
assert(playback.size == 531235)
|
||||
assert(playback.extensions.isDefined)
|
||||
@ -56,10 +62,11 @@ class RecMetaXmlHelperTests extends UnitSpec {
|
||||
}
|
||||
|
||||
it should "get extensions" in {
|
||||
val xml = RecMetaXmlHelper.loadMetadataXml(metaFile)
|
||||
val helper = new RecMetaXmlHelper
|
||||
val xml = helper.loadMetadataXml(metaFile)
|
||||
xml match {
|
||||
case Some(metaXml) =>
|
||||
RecMetaXmlHelper.getMeta(metaXml) match {
|
||||
RecMeta.getMeta(metaXml) match {
|
||||
case Some(meta) =>
|
||||
assert(meta.size == 8)
|
||||
case None => fail("Failed to get extensions element.")
|
||||
@ -70,10 +77,11 @@ class RecMetaXmlHelperTests extends UnitSpec {
|
||||
}
|
||||
|
||||
it should "get breakout rooms" in {
|
||||
val xml = RecMetaXmlHelper.loadMetadataXml(metaFile)
|
||||
val helper = new RecMetaXmlHelper
|
||||
val xml = helper.loadMetadataXml(metaFile)
|
||||
xml match {
|
||||
case Some(metaXml) =>
|
||||
val rooms = RecMetaXmlHelper.getBreakoutRooms(metaXml)
|
||||
val rooms = RecMeta.getBreakoutRooms(metaXml)
|
||||
println(rooms)
|
||||
assert(rooms.length == 2)
|
||||
|
||||
@ -83,10 +91,11 @@ class RecMetaXmlHelperTests extends UnitSpec {
|
||||
}
|
||||
|
||||
it should "get breakout" in {
|
||||
val xml = RecMetaXmlHelper.loadMetadataXml(metaFile)
|
||||
val helper = new RecMetaXmlHelper
|
||||
val xml = helper.loadMetadataXml(metaFile)
|
||||
xml match {
|
||||
case Some(metaXml) =>
|
||||
RecMetaXmlHelper.getBreakout(metaXml) match {
|
||||
RecMeta.getBreakout(metaXml) match {
|
||||
case Some(br) => assert(br.sequence == 2)
|
||||
case None => fail("Failed to get breakout.")
|
||||
}
|
||||
@ -95,12 +104,27 @@ class RecMetaXmlHelperTests extends UnitSpec {
|
||||
}
|
||||
|
||||
it should "get recording metadata" in {
|
||||
val xml = RecMetaXmlHelper.loadMetadataXml(metaFile)
|
||||
val helper = new RecMetaXmlHelper
|
||||
val xml = helper.loadMetadataXml(metaFile)
|
||||
xml match {
|
||||
case Some(metaXml) =>
|
||||
RecMetaXmlHelper.getRecMeta(metaXml) match {
|
||||
RecMeta.getRecMeta(metaXml) match {
|
||||
case Some(br) => assert(br.id == "b27af2f930d418879550e09c7548d1cdd0be25cf-1504122319984")
|
||||
println(RecMetaXmlHelper.getRecMetaXml(br))
|
||||
println(br.toXml())
|
||||
case None => fail("Failed to get recording metadata.")
|
||||
}
|
||||
case None => fail("Failed to load metadata.xml")
|
||||
}
|
||||
}
|
||||
|
||||
it should "get recording metadata and format back to metadata" in {
|
||||
val helper = new RecMetaXmlHelper
|
||||
val xml = helper.loadMetadataXml(metaFile)
|
||||
xml match {
|
||||
case Some(metaXml) =>
|
||||
RecMeta.getRecMeta(metaXml) match {
|
||||
case Some(br) => assert(br.id == "b27af2f930d418879550e09c7548d1cdd0be25cf-1504122319984")
|
||||
println(br.toMetadataXml())
|
||||
case None => fail("Failed to get recording metadata.")
|
||||
}
|
||||
case None => fail("Failed to load metadata.xml")
|
||||
|
@ -1619,7 +1619,7 @@ class ApiController {
|
||||
return
|
||||
}
|
||||
|
||||
List<String> recordIdList = new ArrayList<String>();
|
||||
ArrayList<String> recordIdList = new ArrayList<String>();
|
||||
if (!StringUtils.isEmpty(recordId)) {
|
||||
recordIdList=paramsProcessorUtil.decodeIds(recordId);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user