Skip to content

Commit

Permalink
[SHIRO-889] fix samples POM parent version for 1.11 and CXF xml, fix…
Browse files Browse the repository at this point in the history
…ed and converted Jupiter tests back to classic JUnit, removed javax.crypto from relocation
  • Loading branch information
lprimak committed Dec 9, 2022
1 parent 1e9d890 commit ce955aa
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 25 deletions.
2 changes: 1 addition & 1 deletion bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<artifactId>shiro-root</artifactId>
<groupId>org.apache.shiro</groupId>
<version>2.0.0-SNAPSHOT</version>
<version>1.11.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
4 changes: 0 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -499,10 +499,6 @@
<pattern>javax.ws.rs</pattern>
<shadedPattern>jakarta.ws.rs</shadedPattern>
</relocation>
<relocation>
<pattern>javax.crypto</pattern>
<shadedPattern>jakarta.crypto</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
Expand Down
8 changes: 0 additions & 8 deletions samples/jaxrs/src/main/webapp/WEB-INF/web.cxf.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">

<<<<<<< HEAD:samples/jaxrs/src/main/webapp/WEB-INF/web.cxf.xml
<servlet>
<servlet-name>CXFServlet</servlet-name>
<display-name>CXF Servlet</display-name>
Expand All @@ -38,12 +37,5 @@
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
=======
<parent>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-crypto</artifactId>
<version>2.0.0-SNAPSHOT</version>
</parent>
>>>>>>> c7f359b7... [SHIRO-848] - Relative Path in pom.xml is not needed:crypto/support/pom.xml

</web-app>
6 changes: 5 additions & 1 deletion samples/web-jakarta/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.shiro.samples</groupId>
<artifactId>shiro-samples</artifactId>
<version>2.0.0-SNAPSHOT</version>
<version>1.11.0-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down Expand Up @@ -55,6 +55,10 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-config-ogdl</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
package org.apache.shiro.test.web.jakarta;

import org.apache.meecrowave.Meecrowave;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.AfterClass;
import org.junit.BeforeClass;

import java.io.File;
import java.io.FilenameFilter;
Expand All @@ -31,7 +31,7 @@ public abstract class JakartaAbstractContainerIT {

protected static Meecrowave meecrowave;

@BeforeAll
@BeforeClass
public static void startContainer() {
final File root = new File(getWarDir());
try {
Expand Down Expand Up @@ -61,7 +61,7 @@ public boolean accept(File dir, String name) {
return warFiles[0].getAbsolutePath().replaceFirst("\\.war$", "");
}

@AfterAll
@AfterClass
public static void stopContainer() {
if (meecrowave != null) {
meecrowave.close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@
import jakarta.ws.rs.client.Entity;
import jakarta.ws.rs.core.Cookie;
import jakarta.ws.rs.core.Response;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import org.junit.Test;

import java.net.URI;

Expand All @@ -44,27 +46,27 @@ public void logIn() {
.request(TEXT_HTML_TYPE)
.get()) {
jsessionid = new Cookie("JSESSIONID", loginPage.getMetadata().get("Set-Cookie").get(0).toString().split(";")[0].split("=")[1]);
Assertions.assertTrue(loginPage.readEntity(String.class).contains("loginform"));
assertTrue(loginPage.readEntity(String.class).contains("loginform"));
}

Assertions.assertNotNull(jsessionid);
assertNotNull(jsessionid);
URI location;
try (final Response loginAction = client.target(getBaseUri())
.path("/login.jsp")
.request(APPLICATION_FORM_URLENCODED)
.cookie(jsessionid)
.post(Entity.entity("username=root&password=secret&submit=Login", APPLICATION_FORM_URLENCODED))) {
Assertions.assertEquals(302, loginAction.getStatus());
assertEquals(302, loginAction.getStatus());
location = loginAction.getLocation();
}

Assertions.assertNotNull(location);
assertNotNull(location);
final String loggedPage = client.target(getBaseUri())
.path(location.getPath())
.request(APPLICATION_FORM_URLENCODED)
.cookie(jsessionid)
.get(String.class);
Assertions.assertTrue(loggedPage.contains("Hi root!"));
assertTrue(loggedPage.contains("Hi root!"));
} finally {
client.close();
}
Expand Down

0 comments on commit ce955aa

Please sign in to comment.