Skip to content

Commit

Permalink
Test improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
xpdota committed Dec 29, 2024
1 parent 224a1b0 commit d3b58ae
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

import gg.xp.reevent.events.EventDistributor;
import gg.xp.reevent.events.InitEvent;
import gg.xp.xivdata.data.GameLanguage;
import gg.xp.xivdata.data.*;
import gg.xp.xivsupport.lang.GameLanguageInfoEvent;
import gg.xp.xivsupport.sys.XivMain;
import org.picocontainer.MutablePicoContainer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;

import java.util.Set;
Expand All @@ -17,29 +19,32 @@ public class AllTimelinesLoadedSuccessfullyTest {

private static final Logger log = LoggerFactory.getLogger(AllTimelinesLoadedSuccessfullyTest.class);

@Test
void didAllTimelinesLoad() {
for (GameLanguage value : GameLanguage.values()) {
@DataProvider(parallel = true)
public static Object[] testCases() {
return GameLanguage.class.getEnumConstants();
}

MutablePicoContainer pico = XivMain.testingMasterInit();
EventDistributor dist = pico.getComponent(EventDistributor.class);
dist.acceptEvent(new InitEvent());
dist.acceptEvent(new GameLanguageInfoEvent(value));
TimelineManager manager = pico.getComponent(TimelineManager.class);
Set<Long> timelineZoneIds = TimelineManager.getTimelines().keySet();
int size = timelineZoneIds.size();
log.info("Number of timelines: {}", size);
if (size < 100) {
Assert.fail("Expected at least 100 timelines, got " + size);
}
for (Long timelineZoneId : timelineZoneIds) {
TimelineProcessor proc = manager.getTimeline(timelineZoneId);
Assert.assertNotNull(proc, "Timeline Processor was null for zone " + timelineZoneId);
Assert.assertFalse(proc.getRawEntries().isEmpty(), "Timeline Processor was empty for zone " + timelineZoneId);
}
TimelineInfo firstEntry = TimelineCsvReader.readCsv().get(0);
Assert.assertEquals(firstEntry.zoneId(), 134L);
Assert.assertEquals(firstEntry.filename(), "test.txt");
@Test(dataProvider = "testCases")
@Parameters
void didAllTimelinesLoad(GameLanguage value) {
MutablePicoContainer pico = XivMain.testingMasterInit();
EventDistributor dist = pico.getComponent(EventDistributor.class);
dist.acceptEvent(new InitEvent());
dist.acceptEvent(new GameLanguageInfoEvent(value));
TimelineManager manager = pico.getComponent(TimelineManager.class);
Set<Long> timelineZoneIds = TimelineManager.getTimelines().keySet();
int size = timelineZoneIds.size();
log.info("Number of timelines: {}", size);
if (size < 100) {
Assert.fail("Expected at least 100 timelines, got " + size);
}
for (Long timelineZoneId : timelineZoneIds) {
TimelineProcessor proc = manager.getTimeline(timelineZoneId);
Assert.assertNotNull(proc, "Timeline Processor was null for zone " + timelineZoneId);
Assert.assertFalse(proc.getRawEntries().isEmpty(), "Timeline Processor was empty for zone " + timelineZoneId);
}
TimelineInfo firstEntry = TimelineCsvReader.readCsv().get(0);
Assert.assertEquals(firstEntry.zoneId(), 134L);
Assert.assertEquals(firstEntry.filename(), "test.txt");
}
}
27 changes: 13 additions & 14 deletions triggers/titan-jails/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,25 @@

<artifactId>titan-jails</artifactId>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<!--This one should use a lower thread count since it has some timing-sensitive stuff-->
<threadCount>8</threadCount>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>
<!-- <dependency>-->
<!-- <groupId>gg.xp</groupId>-->
<!-- <artifactId>xivsupport</artifactId>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.testng</groupId>-->
<!-- <artifactId>testng</artifactId>-->
<!-- <scope>test</scope>-->
<!-- </dependency>-->
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<scope>test</scope>
</dependency>
<!-- <dependency>-->
<!-- <groupId>gg.xp</groupId>-->
<!-- <artifactId>testutils-generic</artifactId>-->
<!-- <scope>test</scope>-->
<!-- </dependency>-->
</dependencies>

</project>

0 comments on commit d3b58ae

Please sign in to comment.