From d4328d4c26305d8047c3c5034eaaa62857aa2bf6 Mon Sep 17 00:00:00 2001 From: xp Date: Sun, 21 Nov 2021 22:18:26 -0800 Subject: [PATCH] Fixing build --- .../xp/xivsupport/events/JailExampleTest.java | 63 ++++++------------- .../src/test/resources/logback-test.xml | 4 +- 2 files changed, 21 insertions(+), 46 deletions(-) diff --git a/xivsupport/src/test/java/gg/xp/xivsupport/events/JailExampleTest.java b/xivsupport/src/test/java/gg/xp/xivsupport/events/JailExampleTest.java index eb1324073854..3df2fd73ff9f 100644 --- a/xivsupport/src/test/java/gg/xp/xivsupport/events/JailExampleTest.java +++ b/xivsupport/src/test/java/gg/xp/xivsupport/events/JailExampleTest.java @@ -5,21 +5,20 @@ import gg.xp.reevent.events.DummyEventToForceAutoScan; import gg.xp.reevent.events.Event; import gg.xp.reevent.events.EventDistributor; -import gg.xp.reevent.events.EventMaster; import gg.xp.reevent.events.TestEventCollector; import gg.xp.xivdata.jobs.Job; import gg.xp.xivsupport.events.actlines.events.AbilityUsedEvent; import gg.xp.xivsupport.events.actlines.events.WipeEvent; import gg.xp.xivsupport.events.actlines.events.ZoneChangeEvent; import gg.xp.xivsupport.events.actlines.events.actorcontrol.DutyRecommenceEvent; +import gg.xp.xivsupport.events.state.XivState; import gg.xp.xivsupport.events.triggers.jails.ClearAutoMarkRequest; -import gg.xp.xivsupport.events.triggers.marks.AutoMarkRequest; import gg.xp.xivsupport.events.triggers.jails.FinalTitanJailsSolvedEvent; import gg.xp.xivsupport.events.triggers.jails.JailSolver; import gg.xp.xivsupport.events.triggers.jails.UnsortedTitanJailsSolvedEvent; -import gg.xp.xivsupport.models.XivEntity; -import gg.xp.xivsupport.events.state.XivState; +import gg.xp.xivsupport.events.triggers.marks.AutoMarkRequest; import gg.xp.xivsupport.events.ws.ActWsRawMsg; +import gg.xp.xivsupport.models.XivEntity; import gg.xp.xivsupport.models.XivZone; import gg.xp.xivsupport.persistence.PersistenceProvider; import gg.xp.xivsupport.speech.CalloutEvent; @@ -66,8 +65,6 @@ public void jailTest() throws InterruptedException { XivState state = container.getComponent(XivState.class); // // TODO: still need better support for this... // Thread.sleep(1000); - Assert.assertEquals(state.getPartyList().size(), 8); - Assert.assertEquals(state.getCombatantsListCopy().size(), 8); // Send events @@ -150,11 +147,6 @@ public void testWrongZone() { TestEventCollector collector = new TestEventCollector(); dist.registerHandler(collector); - XivState state = container.getComponent(XivState.class); -// // TODO: still need better support for this... -// Thread.sleep(1000); - Assert.assertEquals(state.getPartyList().size(), 8); - Assert.assertEquals(state.getCombatantsListCopy().size(), 8); dist.acceptEvent(new ZoneChangeEvent(new XivZone(0x123, "Stuff"))); @@ -177,12 +169,6 @@ public void testZoneLockOverride() { JailSolver jails = container.getComponent(JailSolver.class); jails.getOverrideZoneLock().set(true); - XivState state = container.getComponent(XivState.class); -// // TODO: still need better support for this... -// Thread.sleep(1000); - Assert.assertEquals(state.getPartyList().size(), 8); - Assert.assertEquals(state.getCombatantsListCopy().size(), 8); - dist.acceptEvent(new ZoneChangeEvent(new XivZone(0x123, "Stuff"))); // Send events @@ -201,12 +187,6 @@ public void testResets() { TestEventCollector collector = new TestEventCollector(); dist.registerHandler(collector); - XivState state = container.getComponent(XivState.class); -// // TODO: still need better support for this... -// Thread.sleep(1000); - Assert.assertEquals(state.getPartyList().size(), 8); - Assert.assertEquals(state.getCombatantsListCopy().size(), 8); - // Send events dist.acceptEvent(new ACTLogLineEvent("21|2021-09-30T19:43:43.1650000-07:00|40016AA1|Titan|2B6C|Rock Throw|13|Random Person|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|42489|50128|9900|10000|0|1000|86.77625|95.90898|-4.091016E-13|1.591002|2477238|4476950|0|10000|0|1000|113.7886|86.21142|-1.378858E-12|-0.7854581|00009CA2|0|cd69a51d5f584b836fa20c4a5b356612")); @@ -239,10 +219,6 @@ void testDisableTts() throws InterruptedException { TestEventCollector collector = new TestEventCollector(); dist.registerHandler(collector); - XivState state = container.getComponent(XivState.class); - Assert.assertEquals(state.getPartyList().size(), 8); - Assert.assertEquals(state.getCombatantsListCopy().size(), 8); - JailSolver jail = container.getComponent(JailSolver.class); jail.getEnableTts().set(false); @@ -315,10 +291,6 @@ public void disableAmTest() throws InterruptedException { TestEventCollector collector = new TestEventCollector(); dist.registerHandler(collector); - XivState state = container.getComponent(XivState.class); - Assert.assertEquals(state.getPartyList().size(), 8); - Assert.assertEquals(state.getCombatantsListCopy().size(), 8); - JailSolver jail = container.getComponent(JailSolver.class); jail.getEnableAutomark().set(false); @@ -398,12 +370,6 @@ public void resetOrderTest() throws InterruptedException { TestEventCollector collector = new TestEventCollector(); dist.registerHandler(collector); - XivState state = container.getComponent(XivState.class); - // TODO: still need better support for this... - Thread.sleep(1000); - Assert.assertEquals(state.getPartyList().size(), 8); - Assert.assertEquals(state.getCombatantsListCopy().size(), 8); - JailSolver jail = container.getComponent(JailSolver.class); List currentJailSort = new ArrayList<>(jail.getCurrentJailSort()); Collections.reverse(currentJailSort); @@ -489,12 +455,6 @@ public void customOrderTest() throws InterruptedException { TestEventCollector collector = new TestEventCollector(); dist.registerHandler(collector); - XivState state = container.getComponent(XivState.class); - // TODO: still need better support for this... - Thread.sleep(1000); - Assert.assertEquals(state.getPartyList().size(), 8); - Assert.assertEquals(state.getCombatantsListCopy().size(), 8); - JailSolver jail = container.getComponent(JailSolver.class); List currentJailSort = new ArrayList<>(jail.getCurrentJailSort()); Collections.reverse(currentJailSort); @@ -692,6 +652,23 @@ private static MutablePicoContainer setup() { BasicEventQueue queue = container.getComponent(BasicEventQueue.class); queue.waitDrain(); dist.acceptEvent(new DummyEventToForceAutoScan()); + XivState state = container.getComponent(XivState.class); + // TODO: find actual solution to race conditions in tests + try { + Assert.assertEquals(state.getPartyList().size(), 8); + Assert.assertEquals(state.getCombatantsListCopy().size(), 8); + } + catch (Throwable e) { + try { + Thread.sleep(1000); + } + catch (InterruptedException ex) { + ex.printStackTrace(); + } + Assert.assertEquals(state.getPartyList().size(), 8); + Assert.assertEquals(state.getCombatantsListCopy().size(), 8); + } + JailSolver jail = container.getComponent(JailSolver.class); jail.getJailClearDelay().set(1000); diff --git a/xivsupport/src/test/resources/logback-test.xml b/xivsupport/src/test/resources/logback-test.xml index be1e3e871e62..bd8f3e46d122 100644 --- a/xivsupport/src/test/resources/logback-test.xml +++ b/xivsupport/src/test/resources/logback-test.xml @@ -25,8 +25,6 @@ - - - + \ No newline at end of file