forked from Archives/Athou_commafeed
upgrade to dropwizard 4.x
This commit is contained in:
@@ -2,15 +2,15 @@ package com.commafeed.frontend.session;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
import com.commafeed.backend.model.User;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpSession;
|
||||
|
||||
class SessionHelperTest {
|
||||
|
||||
private static final String SESSION_KEY_USER = "user";
|
||||
|
||||
@@ -6,10 +6,6 @@ import java.nio.charset.StandardCharsets;
|
||||
import java.time.Duration;
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.ws.rs.client.Client;
|
||||
import javax.ws.rs.client.Entity;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.awaitility.Awaitility;
|
||||
import org.eclipse.jetty.http.HttpStatus;
|
||||
@@ -31,6 +27,9 @@ import com.commafeed.frontend.model.request.LoginRequest;
|
||||
import com.commafeed.frontend.model.request.SubscribeRequest;
|
||||
|
||||
import io.dropwizard.testing.junit5.DropwizardExtensionsSupport;
|
||||
import jakarta.ws.rs.client.Client;
|
||||
import jakarta.ws.rs.client.Entity;
|
||||
import jakarta.ws.rs.core.Response;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
|
||||
@@ -2,10 +2,6 @@ package com.commafeed.integration;
|
||||
|
||||
import java.util.Base64;
|
||||
|
||||
import javax.ws.rs.client.Entity;
|
||||
import javax.ws.rs.core.HttpHeaders;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
import org.eclipse.jetty.http.HttpStatus;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -16,6 +12,10 @@ import com.commafeed.frontend.model.UserModel;
|
||||
import com.commafeed.frontend.model.request.ProfileModificationRequest;
|
||||
import com.commafeed.frontend.model.request.SubscribeRequest;
|
||||
|
||||
import jakarta.ws.rs.client.Entity;
|
||||
import jakarta.ws.rs.core.HttpHeaders;
|
||||
import jakarta.ws.rs.core.Response;
|
||||
|
||||
class SecurityIT extends BaseIT {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -9,18 +9,18 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import javax.websocket.ClientEndpointConfig;
|
||||
import javax.websocket.ContainerProvider;
|
||||
import javax.websocket.DeploymentException;
|
||||
import javax.websocket.Endpoint;
|
||||
import javax.websocket.EndpointConfig;
|
||||
import javax.websocket.MessageHandler;
|
||||
import javax.websocket.Session;
|
||||
|
||||
import org.awaitility.Awaitility;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import jakarta.websocket.ClientEndpointConfig;
|
||||
import jakarta.websocket.ContainerProvider;
|
||||
import jakarta.websocket.DeploymentException;
|
||||
import jakarta.websocket.Endpoint;
|
||||
import jakarta.websocket.EndpointConfig;
|
||||
import jakarta.websocket.MessageHandler;
|
||||
import jakarta.websocket.Session;
|
||||
|
||||
class WebSocketIT extends BaseIT {
|
||||
|
||||
@Test
|
||||
|
||||
@@ -3,8 +3,6 @@ package com.commafeed.integration.rest;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import javax.ws.rs.client.Entity;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Nested;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -15,6 +13,8 @@ import com.commafeed.frontend.model.UserModel;
|
||||
import com.commafeed.frontend.model.request.IDRequest;
|
||||
import com.commafeed.integration.BaseIT;
|
||||
|
||||
import jakarta.ws.rs.client.Entity;
|
||||
|
||||
class AdminIT extends BaseIT {
|
||||
|
||||
@Test
|
||||
|
||||
@@ -6,10 +6,6 @@ import java.time.Duration;
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.ws.rs.client.Entity;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.awaitility.Awaitility;
|
||||
@@ -31,6 +27,10 @@ import com.commafeed.frontend.model.request.IDRequest;
|
||||
import com.commafeed.frontend.model.request.MarkRequest;
|
||||
import com.commafeed.integration.BaseIT;
|
||||
|
||||
import jakarta.ws.rs.client.Entity;
|
||||
import jakarta.ws.rs.core.MediaType;
|
||||
import jakarta.ws.rs.core.Response;
|
||||
|
||||
class FeedIT extends BaseIT {
|
||||
|
||||
@Nested
|
||||
@@ -175,7 +175,7 @@ class FeedIT extends BaseIT {
|
||||
@Nested
|
||||
class Opml {
|
||||
@Test
|
||||
void importExportOpml() {
|
||||
void importExportOpml() throws IOException {
|
||||
importOpml();
|
||||
String opml = getClient().target(getApiBaseUrl() + "feed/export").request().get(String.class);
|
||||
String expextedOpml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<opml version=\"1.0\">\n" + " <head>\n"
|
||||
@@ -186,14 +186,16 @@ class FeedIT extends BaseIT {
|
||||
Assertions.assertEquals(StringUtils.normalizeSpace(expextedOpml), StringUtils.normalizeSpace(opml));
|
||||
}
|
||||
|
||||
void importOpml() {
|
||||
void importOpml() throws IOException {
|
||||
InputStream stream = Objects.requireNonNull(getClass().getResourceAsStream("/opml/opml_v2.0.xml"));
|
||||
MultiPart multiPart = new MultiPart().bodyPart(new StreamDataBodyPart("file", stream));
|
||||
multiPart.setMediaType(MediaType.MULTIPART_FORM_DATA_TYPE);
|
||||
try (MultiPart multiPart = new MultiPart()) {
|
||||
multiPart.bodyPart(new StreamDataBodyPart("file", stream));
|
||||
multiPart.setMediaType(MediaType.MULTIPART_FORM_DATA_TYPE);
|
||||
|
||||
getClient().target(getApiBaseUrl() + "feed/import")
|
||||
.request()
|
||||
.post(Entity.entity(multiPart, multiPart.getMediaType()), Void.TYPE);
|
||||
getClient().target(getApiBaseUrl() + "feed/import")
|
||||
.request()
|
||||
.post(Entity.entity(multiPart, multiPart.getMediaType()), Void.TYPE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
package com.commafeed.integration.rest;
|
||||
|
||||
import javax.ws.rs.client.Entity;
|
||||
import javax.ws.rs.core.Form;
|
||||
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
@@ -13,6 +10,9 @@ import com.commafeed.frontend.model.request.ProfileModificationRequest;
|
||||
import com.commafeed.frontend.resource.fever.FeverResponse;
|
||||
import com.commafeed.integration.BaseIT;
|
||||
|
||||
import jakarta.ws.rs.client.Entity;
|
||||
import jakarta.ws.rs.core.Form;
|
||||
|
||||
class FeverIT extends BaseIT {
|
||||
|
||||
private Long userId;
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
package com.commafeed.integration.servlet;
|
||||
|
||||
import javax.ws.rs.client.Entity;
|
||||
import javax.ws.rs.core.HttpHeaders;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import com.commafeed.frontend.model.Settings;
|
||||
import com.commafeed.integration.BaseIT;
|
||||
|
||||
import jakarta.ws.rs.client.Entity;
|
||||
import jakarta.ws.rs.core.HttpHeaders;
|
||||
import jakarta.ws.rs.core.Response;
|
||||
|
||||
class CustomCodeIT extends BaseIT {
|
||||
|
||||
@Test
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
package com.commafeed.integration.servlet;
|
||||
|
||||
import javax.ws.rs.core.HttpHeaders;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
import org.eclipse.jetty.http.HttpStatus;
|
||||
import org.glassfish.jersey.client.ClientProperties;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
@@ -10,6 +7,9 @@ import org.junit.jupiter.api.Test;
|
||||
|
||||
import com.commafeed.integration.BaseIT;
|
||||
|
||||
import jakarta.ws.rs.core.HttpHeaders;
|
||||
import jakarta.ws.rs.core.Response;
|
||||
|
||||
class LogoutIT extends BaseIT {
|
||||
|
||||
@Test
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
package com.commafeed.integration.servlet;
|
||||
|
||||
import javax.ws.rs.core.HttpHeaders;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
import org.eclipse.jetty.http.HttpStatus;
|
||||
import org.glassfish.jersey.client.ClientProperties;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
@@ -10,6 +7,9 @@ import org.junit.jupiter.api.Test;
|
||||
|
||||
import com.commafeed.integration.BaseIT;
|
||||
|
||||
import jakarta.ws.rs.core.HttpHeaders;
|
||||
import jakarta.ws.rs.core.Response;
|
||||
|
||||
class NextUnreadIT extends BaseIT {
|
||||
|
||||
@Test
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package com.commafeed.integration.servlet;
|
||||
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import com.commafeed.integration.BaseIT;
|
||||
|
||||
import jakarta.ws.rs.core.Response;
|
||||
|
||||
class RobotsTxtIT extends BaseIT {
|
||||
@Test
|
||||
void test() {
|
||||
|
||||
Reference in New Issue
Block a user