diff --git a/test/main/TestAll.java b/test/main/TestAll.java
index 662eea5d9..dea270d34 100644
--- a/test/main/TestAll.java
+++ b/test/main/TestAll.java
@@ -38,11 +38,13 @@ import com.projectswg.common.debug.log_wrapper.ConsoleLogWrapper;
import network.encryption.TestEncryption;
import resources.TestResources;
+import services.TestServices;
@RunWith(Suite.class)
@SuiteClasses({
TestEncryption.class,
- TestResources.class
+ TestResources.class,
+ TestServices.class
})
public class TestAll {
diff --git a/test/resources/TestResources.java b/test/resources/TestResources.java
index f7e97c702..62f1cf487 100644
--- a/test/resources/TestResources.java
+++ b/test/resources/TestResources.java
@@ -35,8 +35,7 @@ import resources.collections.TestSWGBitSet;
import resources.collections.TestSWGFlag;
import resources.collections.TestSWGList;
import resources.network.TestLittleEndianDataOutputStream;
-import resources.objects.awareness.TestAwareness;
-import resources.objects.quadtree.TestQuadTree;
+import resources.objects.TestObjects;
import resources.persistable.TestPersistable;
import resources.services.TestConfig;
@@ -46,13 +45,12 @@ import resources.services.TestConfig;
TestSWGFlag.class,
TestSWGBitSet.class,
TestWeatherType.class,
- TestQuadTree.class,
TestPersistable.class,
TestConfig.class,
TestPoint3D.class,
TestQuaternion.class,
TestLittleEndianDataOutputStream.class,
- TestAwareness.class
+ TestObjects.class
})
public class TestResources {
diff --git a/test/resources/objects/TestObjects.java b/test/resources/objects/TestObjects.java
new file mode 100644
index 000000000..701b24f32
--- /dev/null
+++ b/test/resources/objects/TestObjects.java
@@ -0,0 +1,45 @@
+/************************************************************************************
+ * Copyright (c) 2015 /// Project SWG /// www.projectswg.com *
+ * *
+ * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on *
+ * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. *
+ * Our goal is to create an emulator which will provide a server for players to *
+ * continue playing a game similar to the one they used to play. We are basing *
+ * it on the final publish of the game prior to end-game events. *
+ * *
+ * This file is part of Holocore. *
+ * *
+ * -------------------------------------------------------------------------------- *
+ * *
+ * Holocore is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Affero General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * Holocore is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU Affero General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Affero General Public License *
+ * along with Holocore. If not, see . *
+ * *
+ ***********************************************************************************/
+package resources.objects;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+
+import resources.objects.awareness.TestAwareness;
+import resources.objects.quadtree.TestQuadTree;
+
+@RunWith(Suite.class)
+@SuiteClasses({
+ TestSWGObject.class,
+ TestQuadTree.class,
+ TestAwareness.class
+})
+public class TestObjects {
+
+}
diff --git a/test/resources/objects/TestSWGObject.java b/test/resources/objects/TestSWGObject.java
new file mode 100644
index 000000000..0e044cd84
--- /dev/null
+++ b/test/resources/objects/TestSWGObject.java
@@ -0,0 +1,63 @@
+/************************************************************************************
+ * Copyright (c) 2015 /// Project SWG /// www.projectswg.com *
+ * *
+ * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on *
+ * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. *
+ * Our goal is to create an emulator which will provide a server for players to *
+ * continue playing a game similar to the one they used to play. We are basing *
+ * it on the final publish of the game prior to end-game events. *
+ * *
+ * This file is part of Holocore. *
+ * *
+ * -------------------------------------------------------------------------------- *
+ * *
+ * Holocore is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Affero General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * Holocore is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU Affero General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Affero General Public License *
+ * along with Holocore. If not, see . *
+ * *
+ ***********************************************************************************/
+package resources.objects;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+import com.projectswg.common.data.location.Location;
+import com.projectswg.common.data.location.Terrain;
+
+import test_resources.GenericCreatureObject;
+
+@RunWith(JUnit4.class)
+public class TestSWGObject {
+
+ @Test
+ public void testWorldLocation() {
+ SWGObject parent = new GenericCreatureObject(1);
+ SWGObject child = new GenericCreatureObject(2);
+ child.moveToContainer(parent);
+
+ Location worldLocation = new Location(15, 17, 19, Terrain.NABOO);
+ parent.setLocation(worldLocation);
+ child.setPosition(0, 0, 0);
+
+ Assert.assertEquals(worldLocation, parent.getWorldLocation());
+ Assert.assertEquals(worldLocation, parent.getLocation());
+ Assert.assertEquals(worldLocation, child.getWorldLocation());
+ Assert.assertEquals(new Location(0, 0, 0, null), child.getLocation());
+
+ child.setPosition(5, 5, 5);
+ Assert.assertEquals(new Location(20, 22, 24, Terrain.NABOO), child.getWorldLocation());
+ Assert.assertEquals(new Location(5, 5, 5, null), child.getLocation());
+ }
+
+}
diff --git a/test/services/TestServices.java b/test/services/TestServices.java
new file mode 100644
index 000000000..acea5ccd4
--- /dev/null
+++ b/test/services/TestServices.java
@@ -0,0 +1,57 @@
+/************************************************************************************
+ * Copyright (c) 2015 /// Project SWG /// www.projectswg.com *
+ * *
+ * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on *
+ * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. *
+ * Our goal is to create an emulator which will provide a server for players to *
+ * continue playing a game similar to the one they used to play. We are basing *
+ * it on the final publish of the game prior to end-game events. *
+ * *
+ * This file is part of Holocore. *
+ * *
+ * -------------------------------------------------------------------------------- *
+ * *
+ * Holocore is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Affero General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * Holocore is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU Affero General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Affero General Public License *
+ * along with Holocore. If not, see . *
+ * *
+ ***********************************************************************************/
+package services;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+
+import resources.server_info.DataManager;
+import services.galaxy.TestGalaxy;
+import services.player.TestPlayer;
+
+@RunWith(Suite.class)
+@SuiteClasses({
+ TestPlayer.class,
+ TestGalaxy.class
+})
+public class TestServices {
+
+ @BeforeClass
+ public static void setupDataManager() {
+ DataManager.initialize();
+ }
+
+ @AfterClass
+ public static void closeDataManager() {
+ DataManager.terminate();
+ }
+
+}
diff --git a/test/services/galaxy/TestGalaxy.java b/test/services/galaxy/TestGalaxy.java
new file mode 100644
index 000000000..d6b9868c9
--- /dev/null
+++ b/test/services/galaxy/TestGalaxy.java
@@ -0,0 +1,44 @@
+/************************************************************************************
+ * Copyright (c) 2015 /// Project SWG /// www.projectswg.com *
+ * *
+ * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on *
+ * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. *
+ * Our goal is to create an emulator which will provide a server for players to *
+ * continue playing a game similar to the one they used to play. We are basing *
+ * it on the final publish of the game prior to end-game events. *
+ * *
+ * This file is part of Holocore. *
+ * *
+ * -------------------------------------------------------------------------------- *
+ * *
+ * Holocore is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Affero General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * Holocore is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU Affero General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Affero General Public License *
+ * along with Holocore. If not, see . *
+ * *
+ ***********************************************************************************/
+package services.galaxy;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+
+import services.galaxy.travel.TestTravelGroup;
+import services.galaxy.travel.TestTravelHelper;
+
+@RunWith(Suite.class)
+@SuiteClasses({
+ TestTravelHelper.class,
+ TestTravelGroup.class
+})
+public class TestGalaxy {
+
+}
diff --git a/test/services/galaxy/travel/TestTravelGroup.java b/test/services/galaxy/travel/TestTravelGroup.java
new file mode 100644
index 000000000..d16420f35
--- /dev/null
+++ b/test/services/galaxy/travel/TestTravelGroup.java
@@ -0,0 +1,42 @@
+/************************************************************************************
+ * Copyright (c) 2015 /// Project SWG /// www.projectswg.com *
+ * *
+ * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on *
+ * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. *
+ * Our goal is to create an emulator which will provide a server for players to *
+ * continue playing a game similar to the one they used to play. We are basing *
+ * it on the final publish of the game prior to end-game events. *
+ * *
+ * This file is part of Holocore. *
+ * *
+ * -------------------------------------------------------------------------------- *
+ * *
+ * Holocore is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Affero General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * Holocore is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU Affero General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Affero General Public License *
+ * along with Holocore. If not, see . *
+ * *
+ ***********************************************************************************/
+package services.galaxy.travel;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+@RunWith(JUnit4.class)
+public class TestTravelGroup {
+
+ @Test
+ public void testNearestPoint() {
+
+ }
+
+}
diff --git a/test/services/galaxy/travel/TestTravelHelper.java b/test/services/galaxy/travel/TestTravelHelper.java
new file mode 100644
index 000000000..7851ba915
--- /dev/null
+++ b/test/services/galaxy/travel/TestTravelHelper.java
@@ -0,0 +1,92 @@
+/************************************************************************************
+ * Copyright (c) 2015 /// Project SWG /// www.projectswg.com *
+ * *
+ * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on *
+ * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. *
+ * Our goal is to create an emulator which will provide a server for players to *
+ * continue playing a game similar to the one they used to play. We are basing *
+ * it on the final publish of the game prior to end-game events. *
+ * *
+ * This file is part of Holocore. *
+ * *
+ * -------------------------------------------------------------------------------- *
+ * *
+ * Holocore is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Affero General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * Holocore is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU Affero General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Affero General Public License *
+ * along with Holocore. If not, see . *
+ * *
+ ***********************************************************************************/
+package services.galaxy.travel;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+import com.projectswg.common.data.location.Location;
+import com.projectswg.common.data.location.Terrain;
+
+import resources.objects.SpecificObject;
+import test_resources.GenericCreatureObject;
+
+@RunWith(JUnit4.class)
+public class TestTravelHelper {
+
+ @Test
+ public void testTravelGroups() {
+ TravelHelper helper = new TravelHelper();
+ Assert.assertNotNull(helper.getTravelGroup(SpecificObject.SO_TRANSPORT_SHUTTLE.getTemplate()));
+ Assert.assertNotNull(helper.getTravelGroup(SpecificObject.SO_TRANSPORT_STARPORT.getTemplate()));
+ Assert.assertNotNull(helper.getTravelGroup(SpecificObject.SO_TRANSPORT_STARPORT_THEED.getTemplate()));
+ }
+
+ @Test
+ public void testRoutesLoaded() {
+ Terrain [] terrains = new Terrain[] {
+ Terrain.CORELLIA, Terrain.DANTOOINE, Terrain.DATHOMIR,
+ Terrain.ENDOR, Terrain.LOK, Terrain.NABOO,
+ Terrain.RORI, Terrain.TALUS, Terrain.TATOOINE,
+ Terrain.YAVIN4, Terrain.MUSTAFAR, Terrain.KASHYYYK_MAIN
+ };
+ TravelHelper helper = new TravelHelper();
+ for (int i = 0; i < terrains.length; i++) {
+ Assert.assertEquals(100, helper.getTravelFee(terrains[i], terrains[i]));
+ }
+ Assert.assertEquals(1250, helper.getTravelFee(Terrain.DATHOMIR, Terrain.CORELLIA));
+ Assert.assertEquals(2000, helper.getTravelFee(Terrain.CORELLIA, Terrain.DATHOMIR));
+ Assert.assertEquals(4000, helper.getTravelFee(Terrain.NABOO, Terrain.ENDOR));
+ Assert.assertEquals(500, helper.getTravelFee(Terrain.TATOOINE, Terrain.NABOO));
+ }
+
+ @Test
+ public void testNearestTravelPoint() {
+ TravelHelper helper = new TravelHelper();
+ TravelPoint starport = new TravelPoint("starport", new Location(50, 0, 50, Terrain.TATOOINE), true, true);
+ TravelPoint shuttleport = new TravelPoint("shuttleport", new Location(-50, 0, -50, Terrain.TATOOINE), false, true);
+ TravelPoint outOfRange = new TravelPoint("outOfRange", new Location(1000, 0, 1000, Terrain.TATOOINE), true, true);
+ helper.addTravelPoint(starport);
+ helper.addTravelPoint(shuttleport);
+ helper.addTravelPoint(outOfRange);
+ GenericCreatureObject creature = new GenericCreatureObject(1);
+ creature.setPosition(Terrain.TATOOINE, 75, 0, 75);
+ Assert.assertEquals(starport, helper.getNearestTravelPoint(creature));
+ creature.setPosition(Terrain.TATOOINE, 25, 0, 25);
+ Assert.assertEquals(starport, helper.getNearestTravelPoint(creature));
+ creature.setPosition(Terrain.TATOOINE, 500, 0, 500);
+ Assert.assertEquals(starport, helper.getNearestTravelPoint(creature));
+ creature.setPosition(Terrain.TATOOINE, -25, 0, -25);
+ Assert.assertEquals(shuttleport, helper.getNearestTravelPoint(creature));
+ creature.setPosition(Terrain.TATOOINE, -75, 0, -75);
+ Assert.assertEquals(shuttleport, helper.getNearestTravelPoint(creature));
+ }
+
+}
diff --git a/test/services/player/TestPlayer.java b/test/services/player/TestPlayer.java
new file mode 100644
index 000000000..0e373a227
--- /dev/null
+++ b/test/services/player/TestPlayer.java
@@ -0,0 +1,42 @@
+/************************************************************************************
+ * Copyright (c) 2015 /// Project SWG /// www.projectswg.com *
+ * *
+ * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on *
+ * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. *
+ * Our goal is to create an emulator which will provide a server for players to *
+ * continue playing a game similar to the one they used to play. We are basing *
+ * it on the final publish of the game prior to end-game events. *
+ * *
+ * This file is part of Holocore. *
+ * *
+ * -------------------------------------------------------------------------------- *
+ * *
+ * Holocore is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Affero General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * Holocore is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU Affero General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Affero General Public License *
+ * along with Holocore. If not, see . *
+ * *
+ ***********************************************************************************/
+package services.player;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+
+import services.player.zone.TestZoneRequester;
+
+@RunWith(Suite.class)
+@SuiteClasses({
+ TestZoneRequester.class
+})
+public class TestPlayer {
+
+}