Skip to content

Commit

Permalink
Merge pull request #11 from dartartem/master
Browse files Browse the repository at this point in the history
moved swagger-ui to META-INF/static-content
  • Loading branch information
cer authored May 18, 2021
2 parents ad221af + 387f77d commit 89fd5df
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 4 deletions.
6 changes: 6 additions & 0 deletions eventuate-util-swagger-ui-tests/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies {
testCompile project(":eventuate-util-swagger-ui")
testCompile "org.springframework.boot:spring-boot-starter-web:${springBootVersion}"
testCompile "org.springframework.boot:spring-boot-starter-test:${springBootVersion}"
testCompile "junit:junit:4.12"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package io.eventuate.util.swaggerui.tests;


import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.context.annotation.Configuration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;

@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = SwaggerUiAvailabilityTest.Config.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class SwaggerUiAvailabilityTest {
@Configuration
@EnableAutoConfiguration
public static class Config {
}

@LocalServerPort
private int port;

@Test
public void testSwaggerUiAvailability() throws IOException {
assertUrlStatusIsOk(String.format("http://%s:%s/swagger-ui/index.html", "localhost", port));
}

private void assertUrlStatusIsOk(String url) throws IOException {
HttpURLConnection connection = (HttpURLConnection)new URL(url).openConnection();

Assert.assertEquals(200, connection.getResponseCode());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
spring.resources.static-locations=classpath:META-INF/static-content
4 changes: 2 additions & 2 deletions eventuate-util-swagger-ui/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ jar {
dependsOn unzipSwaggerUi

from("${buildDir}/swagger-ui-unzipped/swagger-ui-${swaggerUiVersion}/dist") {
into "META-INF/swagger-ui"
into "META-INF/static-content/swagger-ui"
exclude "index.html"
}

from("${buildDir}/swagger-ui-unzipped/swagger-ui-${swaggerUiVersion}/dist/index.html") {
into "META-INF/swagger-ui"
into "META-INF/static-content/swagger-ui"
filter {it.replaceAll("\"https://petstore.swagger.io/v2/swagger.json\"", "window.location.origin + \"/swagger/swagger.yml\"") }
}
}
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

deployUrl=file:///Users/cer/.m2/testdeploy
eventuateMavenRepoUrl=file:///Users/cer/.m2/testdeploy,https://dl.bintray.com/eventuateio-oss/eventuate-maven-release,https://snapshots.repositories.eventuate.io/repository
springBootVersion=1.4.7.RELEASE
springBootVersion=2.2.6.RELEASE
swaggerUiVersion=3.17.1
eventuatePluginsGradleVersion=0.8.0.RELEASE
version=0.11.0-SNAPSHOT
version=0.12.0-SNAPSHOT
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
include "eventuate-util-test"
include "eventuate-util-swagger-ui"
include "eventuate-util-swagger-ui-tests"
include "eventuate-util-spring-swagger"

0 comments on commit 89fd5df

Please sign in to comment.