Skip to content

Commit

Permalink
Merge pull request #17 from jetty/dependabot/maven/12.0.x/org.webjars…
Browse files Browse the repository at this point in the history
…-bootstrap-5.3.3

Bump org.webjars:bootstrap from 5.3.2 to 5.3.3
  • Loading branch information
joakime authored Apr 9, 2024
2 parents 57e444f + db29056 commit a93cfaf
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
2 changes: 1 addition & 1 deletion embedded/path-mapping-handler/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<dependency>
<groupId>org.webjars</groupId>
<artifactId>bootstrap</artifactId>
<version>5.3.2</version>
<version>5.3.3</version>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@
package examples;

import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.charset.StandardCharsets;
import java.util.Properties;

import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.util.component.LifeCycle;
Expand All @@ -30,6 +33,7 @@
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.is;
import static org.junit.jupiter.api.Assertions.assertNotNull;

public class PathMappingServerTest
{
Expand Down Expand Up @@ -90,14 +94,29 @@ public void testGetExtrasResource() throws IOException, InterruptedException
@Test
public void testGetMetaInfResource() throws IOException, InterruptedException
{
Properties props = loadClassPathProperties("/META-INF/maven/org.webjars/bootstrap/pom.properties");
String version = props.getProperty("version");

HttpClient client = HttpClient.newBuilder().build();
HttpRequest request = HttpRequest.newBuilder()
.uri(server.getURI().resolve("/jars/webjars/bootstrap/5.3.2/js/bootstrap.bundle.js"))
.uri(server.getURI().resolve("/jars/webjars/bootstrap/@VER@/js/bootstrap.bundle.js".replace("@VER@", version)))
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString(StandardCharsets.UTF_8));
assertThat(response.statusCode(), is(200));
assertThat(response.body(), containsString("* Bootstrap v5.3.2 (https://getbootstrap.com/)"));
assertThat(response.body(), containsString("* Bootstrap v@VER@ (https://getbootstrap.com/)".replace("@VER@", version)));
}

private Properties loadClassPathProperties(String resourceName) throws IOException
{
URL url = PathMappingServerTest.class.getResource(resourceName);
assertNotNull(url, "Unable to find: " + resourceName);
try (InputStream input = url.openStream())
{
Properties props = new Properties();
props.load(input);
return props;
}
}

/**
Expand Down

0 comments on commit a93cfaf

Please sign in to comment.