renamed HomeboxEntity to HomeboxConnectionEntity
This commit is contained in:
+3
-3
@@ -11,15 +11,15 @@ import lombok.Setter;
|
||||
@DiscriminatorValue("HOMEBOX")
|
||||
@Getter
|
||||
@Setter
|
||||
public class HomeboxEntity extends ConnectionEntity {
|
||||
public class HomeboxConnectionEntity extends ConnectionEntity {
|
||||
|
||||
private String token;
|
||||
private String attachmentToken;
|
||||
private Instant expiresAt;
|
||||
|
||||
public static HomeboxEntity from(ConnectionRequest request, ConnectionResponse response) {
|
||||
public static HomeboxConnectionEntity from(ConnectionRequest request, ConnectionResponse response) {
|
||||
|
||||
HomeboxEntity he = new HomeboxEntity();
|
||||
HomeboxConnectionEntity he = new HomeboxConnectionEntity();
|
||||
|
||||
he.setAppUrl(request.appUrl());
|
||||
he.setUsername(request.username());
|
||||
@@ -82,13 +82,13 @@ public class HomeboxConnectionProvider implements ConnectionProvider {
|
||||
@Override
|
||||
public ConnectionEntity connectionToEntity(ConnectionRequest request,
|
||||
ConnectionResponse response) {
|
||||
return HomeboxEntity.from(request, response);
|
||||
return HomeboxConnectionEntity.from(request, response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateToRepository(ConnectionEntity existing, ConnectionResponse response) {
|
||||
|
||||
if (existing instanceof HomeboxEntity hbE) {
|
||||
if (existing instanceof HomeboxConnectionEntity hbE) {
|
||||
|
||||
hbE.setToken(response.token());
|
||||
hbE.setExpiresAt(response.expiresAt());
|
||||
@@ -100,7 +100,7 @@ public class HomeboxConnectionProvider implements ConnectionProvider {
|
||||
|
||||
@Override
|
||||
public Instant getTokenExpiry(ConnectionEntity entity) {
|
||||
return (entity instanceof HomeboxEntity he) ? he.getExpiresAt() : null;
|
||||
return (entity instanceof HomeboxConnectionEntity he) ? he.getExpiresAt() : null;
|
||||
}
|
||||
|
||||
private record HomeboxLoginResponse(String token, String attachmentToken, Instant expiresAt) {
|
||||
|
||||
@@ -11,7 +11,7 @@ import org.springframework.web.client.RestClient;
|
||||
|
||||
import com.vaessl.app.connection.ConnectionEntity;
|
||||
import com.vaessl.app.connection.ConnectionRepository;
|
||||
import com.vaessl.app.connection.HomeboxEntity;
|
||||
import com.vaessl.app.connection.HomeboxConnectionEntity;
|
||||
import com.vaessl.app.exception.ConnectionNotFoundException;
|
||||
import com.vaessl.app.exception.RemoteApiException;
|
||||
import com.vaessl.app.shared.ServiceItem;
|
||||
@@ -43,7 +43,7 @@ public class HomeboxSearchProvider implements SearchProvider {
|
||||
ConnectionEntity entity =
|
||||
cRepository.findByAppUrlAndUsername(request.appUrl(), request.username());
|
||||
|
||||
if (!(entity instanceof HomeboxEntity hbEntity)) {
|
||||
if (!(entity instanceof HomeboxConnectionEntity hbEntity)) {
|
||||
throw new ConnectionNotFoundException();
|
||||
}
|
||||
|
||||
|
||||
@@ -180,7 +180,7 @@ class HomeboxIntegrationTest {
|
||||
assertThat(dbEntry.getAppUrl()).isEqualTo(request.appUrl());
|
||||
assertThat(dbEntry.getUsername()).isEqualTo(request.username());
|
||||
|
||||
if (dbEntry instanceof HomeboxEntity hbE) {
|
||||
if (dbEntry instanceof HomeboxConnectionEntity hbE) {
|
||||
assertThat(hbE.getToken()).isEqualTo("fake-jwt-token");
|
||||
assertThat(hbE.getAttachmentToken()).isEqualTo("fake-attach");
|
||||
assertThat(hbE.getExpiresAt().toString())
|
||||
|
||||
Reference in New Issue
Block a user