diff --git a/src/main/java/org/olat/core/commons/services/doceditor/collabora/restapi/CollaboraWebService.java b/src/main/java/org/olat/core/commons/services/doceditor/collabora/restapi/CollaboraWebService.java index 342dcd671779c5297c4b43c6564f160d5a46e17a..b19e5706f0f468e91b531e3dad121389f00c1bcd 100644 --- a/src/main/java/org/olat/core/commons/services/doceditor/collabora/restapi/CollaboraWebService.java +++ b/src/main/java/org/olat/core/commons/services/doceditor/collabora/restapi/CollaboraWebService.java @@ -55,6 +55,7 @@ import org.springframework.stereotype.Service; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; +import io.swagger.v3.oas.annotations.Hidden; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; @@ -66,6 +67,7 @@ import io.swagger.v3.oas.annotations.responses.ApiResponse; * @author uhensler, urs.hensler@frentix.com, http://www.frentix.com * */ +@Hidden @Service @Path("/collabora/wopi/files/{fileId}") public class CollaboraWebService { diff --git a/src/main/java/org/olat/core/commons/services/doceditor/office365/restapi/Office365WebService.java b/src/main/java/org/olat/core/commons/services/doceditor/office365/restapi/Office365WebService.java index 6ef468c0d91f1d8d5f99e0abbdac1ad49f27480d..d2e56613865f446f5d0700da071e02528b3311a0 100644 --- a/src/main/java/org/olat/core/commons/services/doceditor/office365/restapi/Office365WebService.java +++ b/src/main/java/org/olat/core/commons/services/doceditor/office365/restapi/Office365WebService.java @@ -55,6 +55,7 @@ import org.springframework.stereotype.Service; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; +import io.swagger.v3.oas.annotations.Hidden; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; @@ -69,6 +70,7 @@ import io.swagger.v3.oas.annotations.tags.Tag; * @author uhensler, urs.hensler@frentix.com, http://www.frentix.com * */ +@Hidden @Tag(name = "Office365") @Service @Path("/office365/wopi/files/{fileId}") diff --git a/src/main/java/org/olat/core/commons/services/doceditor/onlyoffice/restapi/OnlyOfficeWebService.java b/src/main/java/org/olat/core/commons/services/doceditor/onlyoffice/restapi/OnlyOfficeWebService.java index 53cd85266e2a3de65725fc1bd71e09f814da3b21..7f1733e575e8d7716ed93c1280fe3b74f3939df3 100644 --- a/src/main/java/org/olat/core/commons/services/doceditor/onlyoffice/restapi/OnlyOfficeWebService.java +++ b/src/main/java/org/olat/core/commons/services/doceditor/onlyoffice/restapi/OnlyOfficeWebService.java @@ -52,6 +52,7 @@ import org.olat.core.util.vfs.lock.LockResult; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import io.swagger.v3.oas.annotations.Hidden; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; @@ -63,6 +64,7 @@ import io.swagger.v3.oas.annotations.responses.ApiResponse; * @author uhensler, urs.hensler@frentix.com, http://www.frentix.com * */ +@Hidden @Service @Path("/onlyoffice/files/{fileId}") public class OnlyOfficeWebService { diff --git a/src/main/java/org/olat/modules/curriculum/restapi/CurriculumsWebService.java b/src/main/java/org/olat/modules/curriculum/restapi/CurriculumsWebService.java index 6632ffccae0fcaa4acf4596216c11607cdb578ed..4b7b56344660175caa32a6f99ff84d752070fbd3 100644 --- a/src/main/java/org/olat/modules/curriculum/restapi/CurriculumsWebService.java +++ b/src/main/java/org/olat/modules/curriculum/restapi/CurriculumsWebService.java @@ -333,6 +333,18 @@ public class CurriculumsWebService { @GET @Path("elements") + @Operation(summary = "Get the elements of all curriculums", + description = "Get all the elements of all curriculums") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "The elements", + content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = CurriculumElementVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = CurriculumElementVO.class))) + } + ), + @ApiResponse(responseCode = "401", description = "The roles of the authenticated user are not sufficient"), + @ApiResponse(responseCode = "406", description = "application/xml, application/json")} + ) public Response searchCurriculumElement(@QueryParam("externalId") String externalId, @QueryParam("identifier") String identifier, @QueryParam("key") Long key, @Context HttpServletRequest httpRequest) { Roles roles = getRoles(httpRequest); diff --git a/src/main/java/org/olat/modules/openmeetings/restapi/OpenMeetingsWebService.java b/src/main/java/org/olat/modules/openmeetings/restapi/OpenMeetingsWebService.java index 95d09566f7e014ee2f7c4555fe693c8f52666290..f4aeb11b5c0e093a0a8f4a9339a6f2fd1272fca1 100644 --- a/src/main/java/org/olat/modules/openmeetings/restapi/OpenMeetingsWebService.java +++ b/src/main/java/org/olat/modules/openmeetings/restapi/OpenMeetingsWebService.java @@ -40,6 +40,7 @@ import org.olat.user.DisplayPortraitManager; import org.olat.user.UserManager; import org.springframework.stereotype.Component; +import io.swagger.v3.oas.annotations.Hidden; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.responses.ApiResponse; @@ -49,6 +50,7 @@ import io.swagger.v3.oas.annotations.responses.ApiResponse; * @author srosse, stephane.rosse@frentix.com, http://www.frentix.com * */ +@Hidden @Component @Path("openmeetings") public class OpenMeetingsWebService { diff --git a/src/main/java/org/olat/restapi/system/ThreadsWebService.java b/src/main/java/org/olat/restapi/system/ThreadsWebService.java index 9ba7e7d5804ccba290ae99d710de0cce8c6893a7..b917a3185f6a88d9ac844e6f2bbcdb3734d59b1b 100644 --- a/src/main/java/org/olat/restapi/system/ThreadsWebService.java +++ b/src/main/java/org/olat/restapi/system/ThreadsWebService.java @@ -60,6 +60,10 @@ public class ThreadsWebService implements Sampler { } @GET + @Operation(summary = "Retrieve threads info", description = "Retrieve information about threads count and number of deamons") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "The infos", content = { + @Content(mediaType = "text") }) }) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getThreadsXml() { ThreadMXBean bean = ManagementFactory.getThreadMXBean(); diff --git a/src/main/java/org/olat/restapi/system/VFSStatsWebService.java b/src/main/java/org/olat/restapi/system/VFSStatsWebService.java index 1f0acad61abe1881d2b1966036cb1f783b81583d..8979fb27aab16ac379e97bf9af0cd47056d65852 100644 --- a/src/main/java/org/olat/restapi/system/VFSStatsWebService.java +++ b/src/main/java/org/olat/restapi/system/VFSStatsWebService.java @@ -30,6 +30,13 @@ import org.olat.core.commons.services.vfs.manager.VFSRevisionDAO; import org.olat.restapi.system.vo.VFSStatsVO; import org.springframework.beans.factory.annotation.Autowired; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; + /** * * <h3>Description:</h3> @@ -49,6 +56,11 @@ public class VFSStatsWebService { } @GET + @Operation(summary = "Retrieve threads info", description = "Retrieve information about threads count and number of deamons") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "The infos", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = VFSStatsVO.class))), + @Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = VFSStatsVO.class))) }) }) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getRevisionSizeXML() { long size = vfsRevisionDAO.calculateRevisionsSize(); diff --git a/src/test/java/org/olat/restapi/BigBlueButtonStatsWebServiceTest.java b/src/test/java/org/olat/restapi/BigBlueButtonStatsWebServiceTest.java new file mode 100644 index 0000000000000000000000000000000000000000..b82365bbd84f9f6e020831fe7bf6fb47b945fac8 --- /dev/null +++ b/src/test/java/org/olat/restapi/BigBlueButtonStatsWebServiceTest.java @@ -0,0 +1,66 @@ +/** + * <a href="http://www.openolat.org"> + * OpenOLAT - Online Learning and Training</a><br> + * <p> + * Licensed under the Apache License, Version 2.0 (the "License"); <br> + * you may not use this file except in compliance with the License.<br> + * You may obtain a copy of the License at the + * <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a> + * <p> + * Unless required by applicable law or agreed to in writing,<br> + * software distributed under the License is distributed on an "AS IS" BASIS, <br> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br> + * See the License for the specific language governing permissions and <br> + * limitations under the License. + * <p> + * Initial code contributed and copyrighted by<br> + * frentix GmbH, http://www.frentix.com + * <p> + */ +package org.olat.restapi; + +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; + +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.UriBuilder; + +import org.apache.http.HttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.junit.Assert; +import org.junit.Test; +import org.olat.restapi.system.vo.BigBlueButtonStatisticsVO; +import org.olat.test.OlatRestTestCase; + +/** + * + * Initial date: 13 jul. 2020<br> + * @author mjenny, moritz.jenny@frentix.com, http://www.frentix.com + * + */ + +public class BigBlueButtonStatsWebServiceTest extends OlatRestTestCase { + + + @Test + public void bigbluebuttonStatistics() + throws IOException, URISyntaxException { + + RestConnection conn = new RestConnection(); + Assert.assertTrue(conn.login("administrator", "openolat")); + + URI request = UriBuilder.fromUri(getContextURI()).path("system").path("monitoring").path("bigbluebutton").build(); + HttpGet method = conn.createGet(request, MediaType.APPLICATION_JSON, true); + HttpResponse response = conn.execute(method); + Assert.assertEquals(200, response.getStatusLine().getStatusCode()); + + BigBlueButtonStatisticsVO bigBlueButtonStatisticsVO = conn.parse(response, BigBlueButtonStatisticsVO.class); + + Assert.assertEquals(0, bigBlueButtonStatisticsVO.getAttendeesCount()); + Assert.assertEquals(0, bigBlueButtonStatisticsVO.getCapacity()); + Assert.assertEquals(0, bigBlueButtonStatisticsVO.getMeetingsCount()); + Assert.assertEquals(0, bigBlueButtonStatisticsVO.getRecordingCount()); + Assert.assertEquals(0, bigBlueButtonStatisticsVO.getVideoCount()); + } +}