mirror of
https://github.com/Rogiel/l2jserver2
synced 2025-12-13 10:42:54 +00:00
Change-Id: I0000000000000000000000000000000000000000
Change-Id: I8636776eaf000fcdfb528cc403710f6d6ee9e73e Change-Id: Iebc523681d07ecd6d7b7e89343b29a8034558f94
This commit is contained in:
@@ -2,9 +2,9 @@ package com.l2jserver.model.id.factory;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import org.apache.log4j.BasicConfigurator;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
import com.l2jserver.db.dao.DAOModuleMySQL5;
|
||||
@@ -13,11 +13,12 @@ import com.l2jserver.model.id.object.CharacterID;
|
||||
import com.l2jserver.model.id.object.factory.CharacterIDFactory;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.service.BasicServiceModule;
|
||||
import com.l2jserver.service.ServiceModule;
|
||||
import com.l2jserver.service.ServiceStartException;
|
||||
import com.l2jserver.service.database.DatabaseService;
|
||||
|
||||
public class IDFactoryTest {
|
||||
private final Injector injector = Guice.createInjector(
|
||||
private final Injector injector = Guice.createInjector(new ServiceModule(),
|
||||
new BasicServiceModule(), new DAOModuleMySQL5(),
|
||||
new IDFactoryModule());
|
||||
private final CharacterIDFactory charIdFactory = injector
|
||||
@@ -40,10 +41,14 @@ public class IDFactoryTest {
|
||||
|
||||
@Test
|
||||
public void testGetObject() throws ServiceStartException {
|
||||
BasicConfigurator.configure();
|
||||
|
||||
injector.getInstance(DatabaseService.class).start();
|
||||
final CharacterID id1 = charIdFactory.createID(268435456);
|
||||
final L2Character character = id1.getObject();
|
||||
|
||||
|
||||
System.out.println(character.getAppearance().getHairColor());
|
||||
|
||||
Assert.assertNotNull(character);
|
||||
Assert.assertEquals(id1, character.getID());
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import org.junit.Test;
|
||||
|
||||
public class SimpleCacheServiceTest {
|
||||
private final SimpleCacheService cacheService = new SimpleCacheService();
|
||||
|
||||
|
||||
@Test
|
||||
public void testNoArgs() {
|
||||
final TestCacheable cached = cacheService.decorate(TestCacheable.class,
|
||||
@@ -26,7 +26,7 @@ public class SimpleCacheServiceTest {
|
||||
int output2 = cached.random(10);
|
||||
Assert.assertEquals(output1, output2);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testDifferentArgs() {
|
||||
final TestCacheable cached = cacheService.decorate(TestCacheable.class,
|
||||
@@ -47,6 +47,7 @@ public class SimpleCacheServiceTest {
|
||||
|
||||
public interface TestCacheable extends Cacheable {
|
||||
public int random();
|
||||
|
||||
public int random(int arg);
|
||||
|
||||
@IgnoreCaching
|
||||
@@ -55,12 +56,12 @@ public class SimpleCacheServiceTest {
|
||||
|
||||
public static class TestCacheableInstance implements TestCacheable {
|
||||
private final Random random = new Random();
|
||||
|
||||
|
||||
@Override
|
||||
public int random() {
|
||||
return random.nextInt(Integer.MAX_VALUE);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int random(int arg) {
|
||||
return random.nextInt(Integer.MAX_VALUE);
|
||||
|
||||
@@ -37,7 +37,8 @@ public class ScriptingServiceImplTest {
|
||||
"src/test/resources/scripting/testcase.xml"));
|
||||
Assert.assertEquals(1, contexts.size());
|
||||
final ScriptContext context = contexts.get(0);
|
||||
Class<?> clazz = context.getClassLoader().loadClass("test.ScriptingCompilerTest");
|
||||
Class<?> clazz = context.getClassLoader().loadClass(
|
||||
"test.ScriptingCompilerTest");
|
||||
Assert.assertNotNull(clazz);
|
||||
Assert.assertEquals("ScriptingCompilerTest", clazz.getSimpleName());
|
||||
}
|
||||
|
||||
@@ -18,7 +18,8 @@ import com.l2jserver.service.game.scripting.ScriptingServiceImpl;
|
||||
|
||||
public class StaticTemplateServiceTest {
|
||||
private final Injector injector = Guice.createInjector(
|
||||
new BasicServiceModule(), new IDFactoryModule(), new DAOModuleMySQL5(), new AbstractModule() {
|
||||
new BasicServiceModule(), new IDFactoryModule(),
|
||||
new DAOModuleMySQL5(), new AbstractModule() {
|
||||
@Override
|
||||
protected void configure() {
|
||||
bind(ScriptingService.class).to(ScriptingServiceImpl.class)
|
||||
@@ -35,6 +36,7 @@ public class StaticTemplateServiceTest {
|
||||
@Test
|
||||
public void testAdena() throws ServiceStartException {
|
||||
service.start();
|
||||
System.out.println(factory.createID(AdenaItemTemplate.ID).getTemplate());
|
||||
System.out
|
||||
.println(factory.createID(AdenaItemTemplate.ID).getTemplate());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import junit.framework.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
import com.google.inject.AbstractModule;
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
@@ -65,11 +64,11 @@ public class WorldEventDispatcherImplTest {
|
||||
|
||||
@Test
|
||||
public void testListeners1() throws InterruptedException {
|
||||
final L2Character character1 = new L2Character();
|
||||
final L2Character character1 = new L2Character(null);
|
||||
character1.setID(cidFactory.createID());
|
||||
final L2Character character2 = new L2Character();
|
||||
final L2Character character2 = new L2Character(null);
|
||||
character2.setID(cidFactory.createID());
|
||||
final Item item1 = new Item();
|
||||
final Item item1 = new Item(null);
|
||||
item1.setID(iidFactory.createID());
|
||||
world.add(character1);
|
||||
world.add(character2);
|
||||
@@ -106,13 +105,13 @@ public class WorldEventDispatcherImplTest {
|
||||
|
||||
@Test
|
||||
public void testListeners2() throws InterruptedException {
|
||||
final L2Character character1 = new L2Character();
|
||||
final L2Character character1 = new L2Character(null);
|
||||
character1.setID(cidFactory.createID());
|
||||
final L2Character character2 = new L2Character();
|
||||
final L2Character character2 = new L2Character(null);
|
||||
character2.setID(cidFactory.createID());
|
||||
final Item item1 = new Item();
|
||||
final Item item1 = new Item(null);
|
||||
item1.setID(iidFactory.createID());
|
||||
final Item item2 = new Item();
|
||||
final Item item2 = new Item(null);
|
||||
item2.setID(iidFactory.createID());
|
||||
world.add(character1);
|
||||
world.add(character2);
|
||||
|
||||
@@ -9,8 +9,8 @@ import com.google.inject.AbstractModule;
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
import com.google.inject.Scopes;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.model.world.Item;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.model.world.WorldObject;
|
||||
import com.l2jserver.model.world.filter.impl.InstanceFilter;
|
||||
import com.l2jserver.service.BasicServiceModule;
|
||||
@@ -44,29 +44,29 @@ public class WorldServiceImplTest {
|
||||
|
||||
@Test
|
||||
public void testAdd() {
|
||||
final L2Character character = new L2Character();
|
||||
final L2Character character = new L2Character(null);
|
||||
world.add(character);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemove() {
|
||||
final L2Character character = new L2Character();
|
||||
final L2Character character = new L2Character(null);
|
||||
world.add(character);
|
||||
world.remove(character);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testContains() {
|
||||
final L2Character character = new L2Character();
|
||||
final L2Character character = new L2Character(null);
|
||||
world.add(character);
|
||||
Assert.assertTrue(world.contains(character));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIterator() {
|
||||
final L2Character character1 = new L2Character();
|
||||
final L2Character character2 = new L2Character();
|
||||
final Item item1 = new Item();
|
||||
final L2Character character1 = new L2Character(null);
|
||||
final L2Character character2 = new L2Character(null);
|
||||
final Item item1 = new Item(null);
|
||||
world.add(character1);
|
||||
world.add(character2);
|
||||
world.add(item1);
|
||||
|
||||
Reference in New Issue
Block a user