mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
remove warnings
This commit is contained in:
@@ -16,15 +16,12 @@ import io.dropwizard.hibernate.AbstractDAO;
|
|||||||
|
|
||||||
public abstract class GenericDAO<T extends AbstractModel> extends AbstractDAO<T> {
|
public abstract class GenericDAO<T extends AbstractModel> extends AbstractDAO<T> {
|
||||||
|
|
||||||
private final JPAQueryFactory factory;
|
|
||||||
|
|
||||||
protected GenericDAO(SessionFactory sessionFactory) {
|
protected GenericDAO(SessionFactory sessionFactory) {
|
||||||
super(sessionFactory);
|
super(sessionFactory);
|
||||||
this.factory = new JPAQueryFactory(this::currentSession);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected JPAQueryFactory query() {
|
protected JPAQueryFactory query() {
|
||||||
return factory;
|
return new JPAQueryFactory(currentSession());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected JPAUpdateClause updateQuery(EntityPath<T> entityPath) {
|
protected JPAUpdateClause updateQuery(EntityPath<T> entityPath) {
|
||||||
|
|||||||
@@ -58,11 +58,11 @@ public class FeedEntryStatus extends AbstractModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public FeedEntryStatus(User user, FeedSubscription subscription, FeedEntry entry) {
|
public FeedEntryStatus(User user, FeedSubscription subscription, FeedEntry entry) {
|
||||||
setUser(user);
|
this.user = user;
|
||||||
setSubscription(subscription);
|
this.subscription = subscription;
|
||||||
setEntry(entry);
|
this.entry = entry;
|
||||||
setEntryInserted(entry.getInserted());
|
this.entryInserted = entry.getInserted();
|
||||||
setEntryUpdated(entry.getUpdated());
|
this.entryUpdated = entry.getUpdated();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,9 +20,9 @@ abstract class AbstractCustomCodeServlet extends HttpServlet {
|
|||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final UnitOfWork unitOfWork;
|
private final transient UnitOfWork unitOfWork;
|
||||||
private final UserDAO userDAO;
|
private final transient UserDAO userDAO;
|
||||||
private final UserSettingsDAO userSettingsDAO;
|
private final transient UserSettingsDAO userSettingsDAO;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected final void doGet(final HttpServletRequest req, HttpServletResponse resp) throws IOException {
|
protected final void doGet(final HttpServletRequest req, HttpServletResponse resp) throws IOException {
|
||||||
|
|||||||
@@ -23,14 +23,16 @@ import jakarta.websocket.Endpoint;
|
|||||||
import jakarta.websocket.EndpointConfig;
|
import jakarta.websocket.EndpointConfig;
|
||||||
import jakarta.websocket.Session;
|
import jakarta.websocket.Session;
|
||||||
import jakarta.ws.rs.client.Entity;
|
import jakarta.ws.rs.client.Entity;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
class WebSocketIT extends BaseIT {
|
class WebSocketIT extends BaseIT {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void sessionClosedIfNotLoggedIn() throws DeploymentException, IOException {
|
void sessionClosedIfNotLoggedIn() throws DeploymentException, IOException {
|
||||||
AtomicBoolean connected = new AtomicBoolean();
|
AtomicBoolean connected = new AtomicBoolean();
|
||||||
AtomicReference<CloseReason> closeReasonRef = new AtomicReference<>();
|
AtomicReference<CloseReason> closeReasonRef = new AtomicReference<>();
|
||||||
try (Session ignored = ContainerProvider.getWebSocketContainer().connectToServer(new Endpoint() {
|
try (Session session = ContainerProvider.getWebSocketContainer().connectToServer(new Endpoint() {
|
||||||
@Override
|
@Override
|
||||||
public void onOpen(Session session, EndpointConfig config) {
|
public void onOpen(Session session, EndpointConfig config) {
|
||||||
connected.set(true);
|
connected.set(true);
|
||||||
@@ -42,6 +44,7 @@ class WebSocketIT extends BaseIT {
|
|||||||
}
|
}
|
||||||
}, buildConfig("fake-session-id"), URI.create(getWebSocketUrl()))) {
|
}, buildConfig("fake-session-id"), URI.create(getWebSocketUrl()))) {
|
||||||
Awaitility.await().atMost(15, TimeUnit.SECONDS).untilTrue(connected);
|
Awaitility.await().atMost(15, TimeUnit.SECONDS).untilTrue(connected);
|
||||||
|
log.info("connected to {}", session.getRequestURI());
|
||||||
|
|
||||||
Awaitility.await().atMost(15, TimeUnit.SECONDS).until(() -> closeReasonRef.get() != null);
|
Awaitility.await().atMost(15, TimeUnit.SECONDS).until(() -> closeReasonRef.get() != null);
|
||||||
Assertions.assertEquals(CloseReason.CloseCodes.VIOLATED_POLICY, closeReasonRef.get().getCloseCode());
|
Assertions.assertEquals(CloseReason.CloseCodes.VIOLATED_POLICY, closeReasonRef.get().getCloseCode());
|
||||||
@@ -54,7 +57,7 @@ class WebSocketIT extends BaseIT {
|
|||||||
|
|
||||||
AtomicBoolean connected = new AtomicBoolean();
|
AtomicBoolean connected = new AtomicBoolean();
|
||||||
AtomicReference<String> messageRef = new AtomicReference<>();
|
AtomicReference<String> messageRef = new AtomicReference<>();
|
||||||
try (Session ignored = ContainerProvider.getWebSocketContainer().connectToServer(new Endpoint() {
|
try (Session session = ContainerProvider.getWebSocketContainer().connectToServer(new Endpoint() {
|
||||||
@Override
|
@Override
|
||||||
public void onOpen(Session session, EndpointConfig config) {
|
public void onOpen(Session session, EndpointConfig config) {
|
||||||
session.addMessageHandler(String.class, messageRef::set);
|
session.addMessageHandler(String.class, messageRef::set);
|
||||||
@@ -62,6 +65,7 @@ class WebSocketIT extends BaseIT {
|
|||||||
}
|
}
|
||||||
}, buildConfig(sessionId), URI.create(getWebSocketUrl()))) {
|
}, buildConfig(sessionId), URI.create(getWebSocketUrl()))) {
|
||||||
Awaitility.await().atMost(15, TimeUnit.SECONDS).untilTrue(connected);
|
Awaitility.await().atMost(15, TimeUnit.SECONDS).untilTrue(connected);
|
||||||
|
log.info("connected to {}", session.getRequestURI());
|
||||||
|
|
||||||
Long subscriptionId = subscribe(getFeedUrl());
|
Long subscriptionId = subscribe(getFeedUrl());
|
||||||
|
|
||||||
@@ -83,7 +87,7 @@ class WebSocketIT extends BaseIT {
|
|||||||
|
|
||||||
AtomicBoolean connected = new AtomicBoolean();
|
AtomicBoolean connected = new AtomicBoolean();
|
||||||
AtomicReference<String> messageRef = new AtomicReference<>();
|
AtomicReference<String> messageRef = new AtomicReference<>();
|
||||||
try (Session ignored = ContainerProvider.getWebSocketContainer().connectToServer(new Endpoint() {
|
try (Session session = ContainerProvider.getWebSocketContainer().connectToServer(new Endpoint() {
|
||||||
@Override
|
@Override
|
||||||
public void onOpen(Session session, EndpointConfig config) {
|
public void onOpen(Session session, EndpointConfig config) {
|
||||||
session.addMessageHandler(String.class, messageRef::set);
|
session.addMessageHandler(String.class, messageRef::set);
|
||||||
@@ -91,6 +95,7 @@ class WebSocketIT extends BaseIT {
|
|||||||
}
|
}
|
||||||
}, buildConfig(sessionId), URI.create(getWebSocketUrl()))) {
|
}, buildConfig(sessionId), URI.create(getWebSocketUrl()))) {
|
||||||
Awaitility.await().atMost(15, TimeUnit.SECONDS).untilTrue(connected);
|
Awaitility.await().atMost(15, TimeUnit.SECONDS).untilTrue(connected);
|
||||||
|
log.info("connected to {}", session.getRequestURI());
|
||||||
|
|
||||||
feedNowReturnsMoreEntries();
|
feedNowReturnsMoreEntries();
|
||||||
forceRefreshAllFeeds();
|
forceRefreshAllFeeds();
|
||||||
@@ -115,6 +120,7 @@ class WebSocketIT extends BaseIT {
|
|||||||
}
|
}
|
||||||
}, buildConfig(sessionId), URI.create(getWebSocketUrl()))) {
|
}, buildConfig(sessionId), URI.create(getWebSocketUrl()))) {
|
||||||
Awaitility.await().atMost(15, TimeUnit.SECONDS).untilTrue(connected);
|
Awaitility.await().atMost(15, TimeUnit.SECONDS).untilTrue(connected);
|
||||||
|
log.info("connected to {}", session.getRequestURI());
|
||||||
|
|
||||||
session.getAsyncRemote().sendText("ping");
|
session.getAsyncRemote().sendText("ping");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user