diff --git a/src/main/java/com/bigboxer23/meural_control/MeuralComponent.java b/src/main/java/com/bigboxer23/meural_control/MeuralComponent.java index 70c213d..228e072 100644 --- a/src/main/java/com/bigboxer23/meural_control/MeuralComponent.java +++ b/src/main/java/com/bigboxer23/meural_control/MeuralComponent.java @@ -296,6 +296,7 @@ private MediaType getMediaType(File file) { /** Cause a re-fetch of all meural device information on next request */ public void reset() { + logger.warn("resetting api"); token = null; meuralDevice = null; } diff --git a/src/main/java/com/bigboxer23/meural_control/SchedulerComponent.java b/src/main/java/com/bigboxer23/meural_control/SchedulerComponent.java index 4cbad8b..e7b55fb 100644 --- a/src/main/java/com/bigboxer23/meural_control/SchedulerComponent.java +++ b/src/main/java/com/bigboxer23/meural_control/SchedulerComponent.java @@ -61,8 +61,9 @@ private MeuralResponse doAction(Command> command) throws IO api.previewItem(url, false); url.setCleanupTempFile(true); return api.changePicture(url); - } catch (IOException theE) { - logger.warn("doAction", theE); + } catch (IOException e) { + logger.warn("doAction", e); + api.reset(); return new MeuralResponse(); } }) diff --git a/src/test/java/com/bigboxer23/MeuralControllerAppTest.java b/src/test/java/com/bigboxer23/MeuralControllerAppTest.java deleted file mode 100644 index 49bbcff..0000000 --- a/src/test/java/com/bigboxer23/MeuralControllerAppTest.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.bigboxer23; - -import static org.junit.jupiter.api.Assertions.assertTrue; - -import org.junit.jupiter.api.Test; - -/** Unit test for simple App. */ -public class MeuralControllerAppTest { - /** Rigorous Test :-) */ - @Test - public void shouldAnswerWithTrue() { - assertTrue(true); - } -} diff --git a/src/test/java/com/bigboxer23/meural_control/OpenAIComponentTest.java b/src/test/java/com/bigboxer23/meural_control/OpenAIComponentTest.java index 60bde1c..36f5495 100644 --- a/src/test/java/com/bigboxer23/meural_control/OpenAIComponentTest.java +++ b/src/test/java/com/bigboxer23/meural_control/OpenAIComponentTest.java @@ -2,21 +2,11 @@ import static org.junit.jupiter.api.Assertions.*; -import com.bigboxer23.meural_control.data.OpenAIImageGenerationBody; -import com.bigboxer23.meural_control.data.OpenAIImageGenerationResponse; import com.bigboxer23.meural_control.data.SourceItem; -import com.bigboxer23.utils.http.OkHttpUtil; -import com.squareup.moshi.Moshi; -import java.io.IOException; import java.util.Optional; -import okhttp3.MediaType; -import okhttp3.RequestBody; -import okhttp3.Response; -import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.ActiveProfiles;