Skip to content

Commit

Permalink
Merge pull request #19 from indiana-university/fix_info_endpoint
Browse files Browse the repository at this point in the history
LMSA-9255 - Add some missing bits so the /actuator/lms endpoint works…
  • Loading branch information
maurercw committed May 16, 2024
2 parents ecc5c11 + f8168e1 commit ba1741f
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.metrics.buffering.BufferingApplicationStartup;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;

Expand All @@ -68,8 +69,14 @@ public class WebApplication {
@Autowired
private ToolConfig toolConfig;

private final static int STEP_CAPACITY = 2048;

public static void main(String[] args) {
SpringApplication.run(WebApplication.class, args);
SpringApplication app = new SpringApplication(WebApplication.class);
BufferingApplicationStartup startup = new BufferingApplicationStartup(STEP_CAPACITY);
startup.addFilter(startupStep -> startupStep.getName().matches("spring.boot.application.ready"));
app.setApplicationStartup(startup);
app.run(args);
}

@Autowired
Expand Down
5 changes: 3 additions & 2 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,10 @@ app:
overridesFileName: overrides.properties

management:
endpoint.info.enabled: true
endpoints.web.exposure.include: health,info
endpoint.lms.enabled: true
endpoints.web.exposure.include: health,lms
health.redis.enabled: false
info.java.enabled: true

---
spring:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package edu.iu.uits.lms.hierarchyresourcemanager.services.swagger;

/*-
* #%L
* lms-lti-hierarchyresourcemanager
* %%
* Copyright (C) 2015 - 2024 Indiana University
* %%
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. Neither the name of the Indiana University nor the names of its contributors
* may be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* #L%
*/

import edu.iu.uits.lms.hierarchyresourcemanager.WebApplication;
import edu.iu.uits.lms.hierarchyresourcemanager.config.SecurityConfig;
import org.springframework.boot.context.metrics.buffering.BufferingApplicationStartup;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.context.annotation.Import;

@Import({WebApplication.class, SecurityConfig.class})
public class HrmSwaggerConfig {
@MockBean
private BufferingApplicationStartup bufferingApplicationStartup;

}
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,12 @@
* #L%
*/

import edu.iu.uits.lms.hierarchyresourcemanager.WebApplication;
import edu.iu.uits.lms.hierarchyresourcemanager.config.SecurityConfig;
import edu.iu.uits.lms.lti.swagger.AbstractSwaggerCustomTest;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.List;

@SpringBootTest(classes = {WebApplication.class, SecurityConfig.class}, properties = {"lms.rabbitmq.queue_env_suffix = test"})
@SpringBootTest(classes = {HrmSwaggerConfig.class}, properties = {"lms.rabbitmq.queue_env_suffix = test"})
public class SwaggerCustomTest extends AbstractSwaggerCustomTest {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,12 @@
* #L%
*/

import edu.iu.uits.lms.hierarchyresourcemanager.WebApplication;
import edu.iu.uits.lms.hierarchyresourcemanager.config.SecurityConfig;
import edu.iu.uits.lms.lti.swagger.AbstractSwaggerDisabledTest;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.List;

@SpringBootTest(classes = {WebApplication.class, SecurityConfig.class}, properties = {"lms.rabbitmq.queue_env_suffix = test"})
@SpringBootTest(classes = {HrmSwaggerConfig.class}, properties = {"lms.rabbitmq.queue_env_suffix = test"})
public class SwaggerDisabledTest extends AbstractSwaggerDisabledTest {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@
* #L%
*/

import edu.iu.uits.lms.hierarchyresourcemanager.WebApplication;
import edu.iu.uits.lms.hierarchyresourcemanager.config.SecurityConfig;
import edu.iu.uits.lms.lti.swagger.AbstractSwaggerEmbeddedToolTest;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
Expand All @@ -44,7 +42,7 @@
import static edu.iu.uits.lms.email.EmailConstants.EMAILREST_PROFILE;
import static edu.iu.uits.lms.iuonly.IuCustomConstants.IUCUSTOMREST_PROFILE;

@SpringBootTest(classes = {WebApplication.class, SecurityConfig.class}, properties = {"lms.rabbitmq.queue_env_suffix = test"})
@SpringBootTest(classes = {HrmSwaggerConfig.class}, properties = {"lms.rabbitmq.queue_env_suffix = test"})
@ActiveProfiles({IUCUSTOMREST_PROFILE, EMAILREST_PROFILE})
public class SwaggerEmbeddedToolTest extends AbstractSwaggerEmbeddedToolTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,12 @@
* #L%
*/

import edu.iu.uits.lms.hierarchyresourcemanager.WebApplication;
import edu.iu.uits.lms.hierarchyresourcemanager.config.SecurityConfig;
import edu.iu.uits.lms.lti.swagger.AbstractSwaggerUiCustomTest;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.List;

@SpringBootTest(classes = {WebApplication.class, SecurityConfig.class}, properties = {"lms.rabbitmq.queue_env_suffix = test"})
@SpringBootTest(classes = {HrmSwaggerConfig.class}, properties = {"lms.rabbitmq.queue_env_suffix = test"})
public class SwaggerUiCustomTest extends AbstractSwaggerUiCustomTest {

@Override
Expand Down

0 comments on commit ba1741f

Please sign in to comment.